How to stop actor from moving after collision?

chongyunxiang

  • Posts: 216
Hi, how do I stop an actor that has been hit by a bullet, from moving and have it remain in its last position?

JeffreyDriver

  • *
  • Posts: 2149
Try making the collision shape for the bullet a sensor.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

PhilIrby

  • Posts: 545
If setting the bullet to a sensor is not an option, you could set actor to can not be pushed, however that renders the actor unable to collide with tiles. A work around is to just set the actor to a very high mass, high enough that the bullet will not move it.
Below is a quote from Stencylpedia

Heaviness Tab
Mass
How much your actor "weighs." The "heavier" you make an actor, the harder it will be for other objects to move it.
Tip: Setting a very high mass can roughly simulate infinite mass / cannot be pushed, without the side-effects of that mode.

« Last Edit: May 30, 2016, 12:41:05 pm by PhilIrby »

chongyunxiang

  • Posts: 216
I cannot set the bullet to be a sensor. Is there way to upon collision, set self to last location and disable x/y-speed?
I'm trying to set my actor to stop in it's track for a very short while before killing self once it collided with a bullet.

LIBERADO

  • *
  • Posts: 2660
Simply, set to 0 the x-speed and the y-speed of your actor.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

chongyunxiang

  • Posts: 216
I did just that, but the actor was pushed away by the force of the bullet.

LIBERADO

  • *
  • Posts: 2660
First, kill the bullet, then set to 0 the x-speed and the y-speed of the actor.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

tigerteeth

  • Posts: 734
Are you sure you know what a sensor is?

chongyunxiang

  • Posts: 216
[Resolved] I finally got time to look into the game and the reason why I can't set the bullet to a sensor is because I need it to produce a response when it hits another actor type. So I set the actor type that I need to remain still, to a sensor instead. So much for thinking about the bullet when I can simply change the state of the enemy itself! Thanks!!