I am developing car race using jme3, I want to hide my vehicle at the time of running(on some input event), and it has to be visible again (on some input event). But it should not affect the acceleration speed.
I tried by removing from root node, It disappears but it’s physics state is still there. (another car is getting collide with this).
I want to hide completely include the physics state, Is any way to do this?
Thanks in advance,
remove it from the physics space, this might not all be necessary but i like to be sure :), something along these lines:
You could also use setCullHint(CullHint.Always) if you do not want to remove it from the node
Just use setEnabled() on the control. Once the control was added to the physics space calling this will remove and/or add the body to the physics space automatically.
it is working , it removes from physics space (if removed or disabled, it will not respect any accelerate or brake)
but i want the car should be on the move with given accelerate value.
By key event, I want to visible and hide of the vehicle
Is there any alternative way?
The car should not be there but still move?? I think I get something wrong here? Otherwise for what you said (enable/disable car) you’d just have to disable the control and detach the car.
As you get, it is right. when the car is running, for some point of distance, my car should be vanished[Vector Point 1] then it has to appear[Vector Point 2] and run.
Yeah, disable the control, cull the spatial, move the spatial, then activate the control and un-cull the spatial.
cull hides the spatial, but if the control is disabled, i will lose the accelerate and steering. [because my vehicle should be running hidden once it becomes invisible].
Just set a linear velocity.