How do I rotate an object from a non-origin image point?

Get help using Construct 2

Post » Sun Aug 09, 2015 8:59 am

This is what I'm pretty much trying to achieve. The origin point and the axis to which the sprite rotates at need to be separate image points. How do I accomplish this? Can Pins be used if there's not a simple function?
B
20
S
5
Posts: 108
Reputation: 1,473

Post » Sun Aug 09, 2015 4:57 pm

Set X (DesiredX)+20*sin(Sprite.angle)
Set Y (DesiredY)-20*cos(Sprite.angle)

This example will make it rotate around a point 20 pixels below the origin. Hopefully you can adapt the concept to what you need.
B
32
S
9
G
4
Posts: 198
Reputation: 5,079

Post » Sun Aug 09, 2015 7:23 pm

What do I put in for DesiredX?
B
20
S
5
Posts: 108
Reputation: 1,473

Post » Sun Aug 09, 2015 7:56 pm

This could be a way to do it:
viewtopic.php?f=147&t=146141&p=935879&hilit=rotate#p935879
Just replace centerx/centery with the imagepoint x/y.
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Sun Aug 09, 2015 8:19 pm

General J wrote:What do I put in for DesiredX?

Whatever position you want the object to take. Rojohound's solution is better, though.
B
32
S
9
G
4
Posts: 198
Reputation: 5,079

Post » Fri Dec 09, 2016 2:18 pm

Message: shubhamrathi9 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
R0J0hound wrote:This could be a way to do it:
viewtopic.php?f=147&t=146141&p=935879&hilit=rotate#p935879
Just replace centerx/centery with the imagepoint x/y.


Dear Rojohound,
I loved what you have shared here and it have helped a lot but i am not able to solve the same equation if i want rotation to be anti-clockwise.
i have replied to the post in the link you shared, i thought i was not clear there so i m posting here
can you please post an equation that would do the same but for anti-clockwise rotation
it would be a real help as my game mechanism depend completely on it.
Thank you in advance!
B
15
S
5
Posts: 76
Reputation: 1,200

Post » Fri Dec 09, 2016 2:47 pm

never mind ! got it! just had to change some angles to negative! :D
B
15
S
5
Posts: 76
Reputation: 1,200


Return to How do I....?

Who is online

Users browsing this forum: Magistross, mtnboy22, Rable and 6 guests