Hello,
new to Project Chrono. I have been messing around to familiarize myself
with this great project.
I'm unable to change color of objects imported as mesh (obj), here is a
sample code. Green line is where I try to set the color.
What am I 'missing? No matter what color I set, it always shows white.
*import pychrono.core as chimport pychrono.irrlicht as chirrimport
pychrono.cascade as cascadefrom OCC.Core import TopoDSimport math# Create
systemsys = ch.ChSystemSMC()# Create bodies# NOTE: pendulum
pinbody_pendulum_pin =
ch.ChBody()sys.Add(body_pendulum_pin)body_pendulum_pin.SetMass(10)body_pendulum_pin.SetInertiaXX(ch.ChVectorD(20,
20, 20))body_pendulum_pin.SetPos(ch.ChVectorD(0, 0,
0))body_pendulum_pin.SetRot(ch.ChMatrix33D(ch.ChVectorD(1, 0, 0),
ch.ChVectorD(0, 0, -1), ch.ChVectorD(0, 1,
0)))body_pendulum_pin.SetBodyFixed(True)mesh_pin =
ch.ChTriangleMeshConnected()mesh_pin.LoadWavefrontMesh(ch.GetChronoDataFile('models/my_models/pendulum_pin.obj'))vis_shape_pin
=
ch.ChTriangleMeshShape()vis_shape_pin.SetMesh(mesh_pin)vis_shape_pin.SetColor(ch.ChColor(0.5,
0.5, 0.5))body_pendulum_pin.AddVisualShape(vis_shape_pin)#
------------------------------------------# Create the Irrlicht run-time
visualization# ------------------------------------------vis =
chirr.ChVisualSystemIrrlicht()vis.AttachSystem(sys)vis.SetWindowSize(1280,720)vis.SetWindowTitle('Single
pendulum')vis.Initialize()vis.AddCamera(ch.ChVectorD(0, 0, 0.2),
ch.ChVectorD(0, 0, 0))vis.AddTypicalLights()# ------------------# Run the
simulation# ------------------while vis.Run() : vis.BeginScene()
vis.Render() vis.EndScene() sys.DoStepDynamics(0.05)*
--
You received this message because you are subscribed to the Google Groups
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/projectchrono/a7b277a1-cf39-46c5-bf51-34b32b1eb31en%40googlegroups.com.