Constrain Linear Velocity Issues
I have a game I'm working on where when the player lands on some spikes, he gets stuck for a second, then dies and falls. There's other instances where the player is supposed to get stuck as well. Right now, I'm using a boolean attribute to constrain the linear velocities to 0 when he hits the spikes or whatever is supposed to trap him.
The problem is that I've recently added gravity to the game because I've added some particles which I want gravity to effect. But now when the player gets stuck and the boolean attribute constrains the actor, the actor still moves down slowly due to the gravity acting on it. How can I get the actor to be immovable when I want him stuck somewhere? Anyone else run into this issue?
The problem is that I've recently added gravity to the game because I've added some particles which I want gravity to effect. But now when the player gets stuck and the boolean attribute constrains the actor, the actor still moves down slowly due to the gravity acting on it. How can I get the actor to be immovable when I want him stuck somewhere? Anyone else run into this issue?
Comments
make 2 real attribute call them stayX and stayY
when the actor collides with the spikes change stayX to self position x and change stayY
then constrain self position x to stayX and constrain self position y to strayY