0 Favourites

# Synchronise an object position based on second object angle

• 3 posts
• Hello,

What i wish to do is take Object A angle and set Object B position relative to the angle of Object A at a certain distance (lets say 200pixels) so if the Object A is taking another direction, the Object B must stay at 200 pixels in front of Object A at 200 pixels of position of Object A. The idea is if i am shooting object A that object b could serve as a detector in front of Object A. (This is not a line of sight only a simple detector.)

Any ideas what i can use for this ?

Thanks for your help! Greatly appreciated.

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Hello,

What i wish to do is take Object A angle and set Object B position relative to the angle of Object A at a certain distance (lets say 200pixels) so if the Object A is taking another direction, the Object B must stay at 200 pixels in front of Object A at 200 pixels of position of Object A. The idea is if i am shooting object A that object b could serve as a detector in front of Object A. (This is not a line of sight only a simple detector.)

Any ideas what i can use for this ?

Thanks for your help! Greatly appreciated.

you could use the Pin behavior on ObjectB, and pin "position and angle" relative to Object A

Or you could set ObjectB position to :

X: 200*cos(ObjectA.Angle)+ObjectA.X

Y: 200*sin(ObjectA.Angle)+ObjectA.Y

Or even set an object point in the image editor 200 pixels forward the center of ObjectA, and set the position of ObjectB to it.

• > Hello,

>

> What i wish to do is take Object A angle and set Object B position relative to the angle of Object A at a certain distance (lets say 200pixels) so if the Object A is taking another direction, the Object B must stay at 200 pixels in front of Object A at 200 pixels of position of Object A. The idea is if i am shooting object A that object b could serve as a detector in front of Object A. (This is not a line of sight only a simple detector.)

>

> Any ideas what i can use for this ?

>

> Thanks for your help! Greatly appreciated.

>

you could use the Pin behavior on ObjectB, and pin "position and angle" relative to Object A

Or you could set ObjectB position to :

X: 200*cos(ObjectA.Angle)+ObjectA.X

Y: 200*sin(ObjectA.Angle)+ObjectA.Y

Or even set an object point in the image editor 200 pixels forward the center of ObjectA, and set the position of ObjectB to it.

Work fine! Thanks a lots for your help.

• 3 posts