LSL Havok Physics Info?
needs info
Nexii Malthus
I'm not familiar with the internals of how the physics engine works but it would be great for many applications, vehicles in particular, if you could get additional physics information at that moment in time.
Particularly vehicles need to understand if the vehicle is "grounded" or free falling. Currently this is done through llCastRay at the locations of the wheels downwards, but for some vehicles that are track based such as tanks that have a larger surface area this becomes bit more tricky to raycast when dealing with uneven and complicated surface environments like rubble or offroad.
It would be great if a Linden could investigate additional useful physics info that could be surfaced to scripts if the Havok physics engine is already aware of certain information about objects.
I do know that Havok physics has a 'sleep' state for objects which could be useful to know, likewise the script also enter a sleepier state by slowing down timer events if it's not actively moving for example.
Gotcha is that this is stuff perhaps specific to Havok engine behaviour, so switching to a modern, multi-threaded engine like Jolt (https://github.com/jrouwe/JoltPhysics) which might not have this info could break this functionality.
There might be also something from the linden vehicle code that could be surfaced, as VEHICLE_FLAG_LIMIT_MOTOR_UP requires the sim to know if a vehicle is airborne or not.
Log In
Maestro Linden
needs info
Maestro Linden
Hi Nexii Malthus can you please elaborate on your use case for looking up the 'sleep' state of an object, and how the existing LSL support for looking up other objects' physics status (OBJECT_PHYSICS, OBJECT_VELOCITY, etc.) falls short of what you need to know?
Nexii Malthus
Maestro Linden, I've actually tried to use physics/velocity but there are situations where an object could be continuously colliding despite minimal physics movement, such as a vehicle on a slightly sloped ramp. This either caused a weird cycling between deep sleep and active, or it went into deep sleep and had moved very very slowly over minutes causing significant error from where it initially feel asleep. Disabling physics caused many other issues such as falling asleep and disabling physics on a vehicle elevator, or failing to be pushed by external forces when it should.
The continuous movement could possibly be a bug with the havok physics engine as I'm using artificial gravity and maybe it's not recognising a proper resting state, some issue with dynamic friction perhaps or not being able to deal with llSetForce of high friction objects against a flat/sloped surface not resting properly.
---
The other usecase which is huge is to be able to tell whether a object is grounded or not, which can be used by vehicle scripters to tell whether to disable motor input and tweak vehicle parameters/decays or to continue being in control of motion.