Bow and Arrow position when struck
KC_Games
Member, PRO Posts: 86
How do I make an arrow look like it is stuck in an another actor after the actor has been struck with an arrow? Right now I have a collision, but it just bounces it off the actor but I want it to be half way stuck in the actor and follow the actor's coordinates. I would think that I just constrain the X and Y and rotation to the actor that is struck, but I don't know how to do this. The arrow is spawned after the mouse release and there are a bunch of actors spawning from the right. This seems easy, but I can't get it. Do I just use tags? Tags don't showing up in the Expression Editor. Thanks.
Comments
Tags are not in the expression editor they are a way of grouping actors together for collision. For example you might have a dozen different wall actors and when your hero collides with them you would need a Collision behaviour for each wall actor in your hero actor. By using tags you can group all those wall actors together and place one Collision behaviour in your hero actor.
Overlaps or collides is a rule condition so when the hero collides with the wall the condition is true and the code inside the rule will now run. The actors will also react to each other depending on the physic's setting you set in each actor.
In this case when your arrow collides with the enemy actor you can run an animation in the enemy with an arrow stuck in him and destroy the arrow actor. Or you can constrain the arrow actor to the enemy actor as you described.
There are plenty of videos on tags and constraining actors together do a serach and you will find them. Also The_Gamesalad_Guru and GSHelper have lots of videos on this and all kinds of stuff.
http://gshelper.com
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Thanks for the reply colander, appreciate it, but I'm still not able to do it. How would I set it up so if one kind of actor (arrow) overlaps another actor (enemy), the arrow actor's X,Y and rotation are constrained to the enemy actor? Both actors are spawned and so are not on the stage at start and therefore I don't see them in the Expression editor to reference. I don't know if this is making any sense, but I am trying to explain as best I can. Just want an arrow to stick into another actor. Thank you in advance.
this is off the top of my head:
track the magnitude of the arrow to the enemy
when the magnitude (distance) is less than 50 pixels (or whatever it would be when a hit is there
constrain the x and y position to enemy's x and y plus an offset..
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Thanks jonmulcahy, I'll try that when I get home from work in a couple of hours.