#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# repel and actor?

Posts: 247Member
edited 9:03AM
Hey all,

I'm trying to set an actor (a block) so that it will repel another actor. Can someone steer me in the right direction? Should I look into using magnitude for this?

Thanks!

• Posts: 247Member
...anyone out there? :-)
• Posts: 485Member
Yep, I would look at TSB's demo that displays the distance between multiple actors and in your case, make the other actor move in an opposing direction; either using the inverse of the angle of the actor moving towards it or in a random direction.

• Posts: 247Member
In my case, I want the moving actor to be affected by the repelling object. So imagine if a balloon (actor) were drifting across a room and comes in contact with a fan that blows it up.
• Posts: 485Member
In the example that you just posted, I would have an invisible actor in front of my fan providing 'radar' for the fan actor and if my balloon actor overlapped with it, then I would move the balloon in a direction that made sense to how the fan was blowing.
• Posts: 1,400Member
Not sure which is more efficient processor-wise, but you could also constrain the balloon's X and Y attributes to game attributes. Monitoring that info from the fan actor would allow you to determine how close the balloon is (magnitude) as well as its angle in relation to the fan (vectortoangle).
• Posts: 247Member
Hmmm, I didn't think about processor issues. If I did make a fan type object it would mean that there was constant motion in a direction. OK, I get that.

How about if that repel object was like a trampoline? So when the actor comes in contact with it it bounces away, or to a new direction. Ideally my main actor would travel along and have a change a direction from these repelling objects. I would like to be able to move/rotate these objects in order to help direct the main actor through the scene. Makes sense? BTW, the balloon was just a reference. The main actor is not a balloon.

Thanks!
• Posts: 247Member
OK, I really could use some help on this one. So far, I've been testing with two actors.

Actor1
--Move:relative to actor, speed 100
--Collide: with actor2
--Accelerate 90* relative to actor, speed 300.

Actor2
--no behaviors
--and is set at an angle in the travel path of actor1. Ideally when actor1 collides with actor2 it should influence to change actor1's direction and speed. Think of kitty cannon as it hits a trampoline mid flight it gets a boost!

Obviously this is not working. I have a hunch that I should be looking at magnitude but I'm not clear on this this works. Anyone??
This discussion has been closed.