Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Allowing an object to bounce off walls only when certain forces are applied

$
0
0
I’m currently using rigidbodies and Forces to control the main character in my game. There are two types of forces that can affect the character: When the player uses the ASDW keys to control the character, and when the character experiences “knockback” from something in the game world. For example, the characters are hit with an explosion, which adds a large amount of knockback force to them. I’d like for characters to bounce off of walls as a result of this knockback force. I know how to make the character change direction when colliding with a wall, but I’d like this direction change to occur ONLY as a result of the knockback force, and not from the “ASDW” force being applied by the player. Is there some easy-ish way of isolating this knockback force and applying the bounce effect in conjunction with it?

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>