About Havok feature

mm i see can be a good idea to add them please :wink:
physics time can be very different than render time.

also what about car and particle
i see havok include car system since start

3 Likes

Thanks for the heads up on this! Could we please expose trigger functionality in the WASM?

As 3th mentioned, we may want to run physics at a tick rate different from the rendering FPS

Also, I was hoping to run Havok in a Web Worker so that physics can run in another thread while Babylon rendering runs on the main thread. So, it seems that trigger functionality would not be possible in this case if it isn’t exposed in the WASM

1 Like

Havok is designed to be parallel. It spawns threads after narrrow phase, before the solve step since it knows whichs sets will plausibly interact. Ie: 5 blocks towers far enough apart they wouldnt touch would spawn 5 threads. It would be much better if you asked for a build with pthreads turned on. Emcc will generate a thread pool and even use shared memory not message passing and not cloning. Ofc, it wont be 5x faster because you have coordination static time. Like , if coordination is only 5% of time, that still means a billion threads would be max 20x improvement. Still a big win though and its designed to be used that way.

2 Likes

terrain work my bad
i was make mistake in my height array so is that

geometry = havok.HP_Shape_CreateHeightField( sample.x, sample.y, scale, heightData.byteOffset )[1]
scale is terrain size {x,y,z}
heightData is Float32Array of all height value like trimesh triangle

now let see if we can move it :grinning:
well we can move but is not well update
maybe they are function like physx modifySamples ?

LINK

4 Likes

about joint, i start testing and i don’t see any spring setting ?
on each axis normally we can chose stiffness, damping …
they are only friction ?

mm i think joint X Z axis is reverse ?
perpAxisA & perpAxisB use getNormalToRef from there own axe
but result seem’s wrong axis when i compare to the other engine
i have to switch x and z to get same result

Can you please do a PG repro so we can take a look?

mm is complex
i try to have same result in all engins
so i use wrong base axis 0,0,1, good one is 1,0,0
with good axe is work no need reverse

i see another problem joint not wake up body on action

link is same upside on joint demo ( have to update )

ok is done full joint test
demo

orientation is good
but constraint need more option seem’s too flexible
not enough strong ( look car demo )

motor target not work like expected ?
and can setup softness or number iteration
also option for disable sleep is need

1 Like

The last update are great :+1:
constraint give expect result with Stiffness and Damping

something else
kinematic object need force position on each frame or else it moves strangely ?
so i add option to lock position with HP_Body_SetTargetQTransform

2 Likes

new state function work like expected

if( o.sleep ) havok.HP_Body_SetActivationState (b, havok.ActivationState.INACTIVE );
if( o.activate || o.wake ){
     havok.HP_Body_SetActivationControl( b, havok.ActivationControl.SIMULATION_CONTROLLED );
     havok.HP_Body_SetActivationState (b, havok.ActivationState.ACTIVE );
}
if( o.neverSleep !== undefined ) havok.HP_Body_SetActivationControl(b, o.neverSleep ? havok.ActivationControl.ALWAYS_ACTIVE : havok.ActivationControl.SIMULATION_CONTROLLED );
if( o.alwaySleep !== undefined ) havok.HP_Body_SetActivationControl(b, o.alwaySleep ? havok.ActivationControl.ALWAYS_INACTIVE : havok.ActivationControl.SIMULATION_CONTROLLED );

exept sleep, if we set sleep at simulation start object should not move on first collision
if we make a stack of boxes and set sleep box should not move
( look PHY demo Basic on havok and physx )

but anyway is a must have :slight_smile:
what is HP_Body_SetActivationPriority and what the value ?

That’s exactly why sleep mode exists: bodies don’t move until they get their first collision/force

HP_Body_SetActivationPriority is not used by havok plugin and we won’t do support for Havok wasm use outside Babylon.js.

yes sound good
i think the space of test collision is more reactive that other engine.
anyway collision is very good even on very small objects.
i will make more test