Irrlicht Newton GD tutorial: finishing the first scene
If you remember, we ended our coding excercises at place, where we almost created our first Newtonian body, but we did not actually have enough models.
We discussed collision shapes a bit. So let’s create one for our brand new model!
We have a nice ramp to work with. But how we can reconstruct the same shape in the terms of Newton? Newton offers a set of collision shapes for us:
Sphere
Box
Cone
Capsule
Cylinder
Chamfer Cylinder
Convex Hull
Trimesh
Obviously, not sphere, cone, capsule, nor cylinder make sense for us. We could use box shape, but then we simply ignore our inner faces (inside walls):
A bit better, but still the same situation with convex hull shape:
Generally, the way we create our Newtonian body is:
- create collision shape
- create blank Newtonian body
- set body properties like collision shape, mass, inertia parameters, etc.
- store the pointer to the graphical entity for that body in the
userData
property
And then Newton Game Dynamics will take your body into account when processing other objects
in the NewtonWorld
.