So, yet again I face issues with regards to HL specific code.
In Bullet Physics, SoftBodies and RigidBodies have different world gravity. So, if a soft body is present in a scene, I need to set the world gravity at two different locations by code. One for RigidBodyWorld and the other for SoftBodyWorld.
I am unable to set this value(my gravity) to a specific variable(SoftBodyWorld gravity). That is, the value of the SoftBodyWorld gravity remains the same as before. However, no errors during compile time or runtime.
After debugging the code in native C, I see that the value is indeed being set, but immediately after being set, the same value is reverted back to its original. Hence no actual changes made.
The same value, when set for JS targets, works perfectly.
//gravity: Vec4 var softSolver = new bullet.Bt.DefaultSoftBodySolver(); world = new bullet.Bt.SoftRigidDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration, softSolver); var vec1: bullet.Bt.Vector3 = null; vec1.setX(gravity.x); vec1.setY(gravity.y); vec1.setZ(gravity.z); var worldInfo = world.getWorldInfo(); #if js worldGravity = worldInfo.set_m_gravity(vec1); //Works as expected #else worldInfo.m_gravity.setValue(gravity.x, gravity.y, gravity.z); //Does not work #end
The IDL definitions:
The value I like to set: m_gravity
The function used to set the gravity: set_m_gravity
Corresponding Bt.hx function: set_m_gravity()
Any insight on why this might be the case would be very helpful.