[Swift] Change the color of SCN Node

When I drew on SceneKit View, I wanted to change the drawing color, so I checked it.

Execution environment version
Swift 5
Xcode 12.0

I am creating a ball node as an example.


let ball = SCNSphere(radius: 0.01)
let node = SCNNode(geometry: ball)

//Color change code
ball.firstMaterial?.diffuse.contents = UIColor.red

You can change the color by putting your favorite color in the UIColor.Red </ code> part.

Recommended Posts

[Swift] Change the color of SCN Node
[Swift] Change the textColor of UIDatePicker
[Eclipse] Change the color of the vertical ruler
Bootstrap4 Change the color of the hamburger menu
[AndroidStudio] Change the color of the ActionBarDrawerToggle hamburger menu
[swift5] How to change the color of TabBar or the color of item of TabBar with code
About [Cocoa] [Swift] AirPlay 2
[Swift] Change the textColor of UIDatePicker
[Swift] The color of the Navigation Bar is different (lighter) from the specified color.
[Swift] Vaguely grasp the flow of Delegate
[Swift] Get the height of Safe Area
[Rails] Change the label name of f.label
Ransack sort_link How to change the color!
The basic basis of Swift custom cells
Change the URL of the application of Eclipse project (Maven).
[Swift] How to change the order of Bar Items in Tab Bar Controller [Beginner]
Change the timezone of the https-portal container to JST
[Swift] Random color
How Microservices Change the Way of Developing Applications
Change the location folder of Docker image & container
[Swift] Termination of the program by the fatalError function
[Swift] Get the number of steps with CMP edometer
[Active Admin] Color the title (panel) part of the form
[Rails] Cancel / change the default password validation of devise
[Swift] This is the solution! Illustration of Delegate implementation
Ruby, Nokogiri: Get the element name of the selected node
Change the storage quality of JPEG images in Java
Find the approximate value of log (1 + x) in Swift
[Swift] How to get the document ID of Firebase
The world of clara-rules (2)
Judgment of the calendar
The world of clara-rules (4)
The world of clara-rules (1)
The world of clara-rules (3)
I want to change the color of the upper control navigation bar (Control menu) in Liferay 7 / DXP
The world of clara-rules (5)
The idea of quicksort
The idea of jQuery
Now, I understand the coordinate transformation method of UIView (Swift)
iOS app development: Timer app (9. Customize the color of the progress bar)
I want to change the log output settings of UtilLoggingJdbcLogger
[Swift] Lightly introduce the logic of the app that passed the selection
Change the file name and output destination of the JavaVM error file
How to change the setting value of Springboot Hikari CP
[Rails] When the layout change of devise is not reflected
How to change the contents of the jar file without decompressing
[Swift] Get the timing when the value of textField is changed
When you want to change the MySQL password of docker-compose
How to change BackgroundColor etc. of NavigationBar in Swift UI