Thread: Adjusting object's angle and position based on another object's angle and posistion?

1. Adjusting object's angle and position based on another object's angle and posistion?

So I've attached an animated GIF to try and explain this better.

Basically I would like to be able to attach a smaller object to a larger object, and have the smaller object's angle and position change correctly as the bigger object's angle is changed.
Imagine the bigger object is a room and the smaller object is a chair in that room. When rotating the room, the chair would change position and angle to stay in the correct spot within that room.
If my explanation is poorly worded, just look at the GIF and it should make sense. Anyone got any ideas on how I can pull it off? Thanks!

2. You can use an Action Spot in the corner of the big object as an anchor and then just set the angle and position(based on Action Spot) of your smaller object to match the bigger one.

edit: There is no real point in dividing it into 2 events like I did in my example. For some reason I just wanted to separate the parts where I just rotate the big one from the part where I move and rotate the smaller one.

3. Here is a way to do it with multiple objects and trig.

The issue is that this can only be applied to a certain extent. Handling object movements while they're attached becomes a whole different ball game that I wouldn't be comfortable throwing together myself. This example can scale to an infinite number of objects, though.

Arrow keys rotate, clicking creates a new object

4. This is a very good approach.

There is a small thing that should be added in line 7 though:
X( "Base Object" ) + Cos(Angle From( "Sticky" )) * Dist( "Sticky" ) + 0.5
Y( "Base Object" ) - Sin(Angle From( "Sticky" )) * Dist( "Sticky" ) + 0.5

5. Great example, Gamester.

Some advice too: you should set X and Y of player to Round(xpos) and Round(ypos) to avoid floating point precision errors in Fusion. This is a problem that annoyed me for the longest time until a Clickteam member helped me out. When trying to make a smooth camera, I noticed one side would be offset by a pixel or two when easing. Setting position to Round(pos) instead of just pos kept it smooth but eliminated that problem.

This is probably what @Wodjanoi 's tweak fixes.

6. Yes, both methods are possible in this case to prevent the floating point issue.

I learned about this at a relatively late stage too - I assume it was the same helpful person who informed me and solved a wobbly camera problem in one of my projects.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•