schteppe/cannon.js

about cannon.js Constraint function of physical engine

yiuxiu opened this issue · 4 comments

I use a cylinder to simulate a human. When I move a cylinder, how do I write constraint codes to ensure that the cylinder is upright, that is, to prevent people from falling

@yiuxiu you can use the fixedRotation option

@ yiuxiu 你可以使用 fixedRotation 选项

http://schteppe.github.io/cannon.js/docs/classes/Body.html

image

Thank you. At present, it can also be used. But it's better to let the object rotate around the Y axis and limit the rotation of the X and Z axes

If the direction of gravity is along the Y axis,How do I change the direction of the wheels,About RaycastVehicle Class..Here is the address of your code https://github.com/schteppe/cannon.js/blob/master/demos/raycastVehicle.html

@Guo-Zhiqiang check out this example, the gravity is:

world.gravity.set(0, -10, 0)

https://github.com/pmndrs/cannon-es/blob/master/examples/raycast_vehicle.html