How do I rotate a sprite from an image point using physics

Get help using Construct 2

Post » Thu May 05, 2016 4:55 pm

Message: dondosh can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi everyone,

This is my first post on this forum.

I need help to rotate a paddle from an image point using physics. I succeed with Set Angle, but it glitch because of the physics behaviour.
I tried to use a limited revolute joint and apply force to the paddle to another image point , but I cannot make it work. I know I'm not really clear but look at these images.

When player is not pressing "Spacebar",I want the paddle to stay in this position:
Image

When player press "Spacebar", I want the paddles to smoothly rotate to this position:
Image

I'm trying to do a game like 100 balls: https://play.google.com/store/apps/deta ... alls&hl=en
EDIT: I cannot post a link so i will paste an image of the game here:
Image

Thanks I hope anyone can help me !
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Thu May 05, 2016 7:20 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu May 05, 2016 7:27 pm

Yeah exactly, can you explain a little why you use value like -33333 for the torque force.

EDIT: I play a little with your capx file and I think that the Keyboard Space event is down does nothing. Because I removed the event completely and the paddle keep going down while Space was not pressed. It look like it's the gravity that make the paddle drop (when not pressing Space), but you put gravity to zero on paddle On start layout. So I'm a little confuse.

Man if you could explain it, it would be so nice. I already learn a little with you file.

Thanks a lot !
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Thu May 05, 2016 8:45 pm

The Keyboard 'Space event is down' ads some counterforce to soften it all some, when you release the things. It might need some adjustment. Else those things jump everywhere if you push the paddles back.

And yes, 'Space is not down' works against the gravity force. Its just pushing against the falling things. They fall due gravity. Thats was key and a demand in your question. Can rotate those paddles in easyer ways. You wanted it done by physics. And that got me curious. Just like you, i am here to learn by trying to solve other poeples puzzles.

Regarding the big numbers. Its is a bit like in real live, if you only apply torque, you need a lot of force. Try closing a door by pushing close to the hinges.

I did't choose those numbers by logic. I just made them big enough to push against the against the gravity, by try and error. To be honest, i did't gave it that much time.

I just mimicked real life physics.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu May 05, 2016 9:29 pm

OK thank you for your explanation. Yeah I want to do it with physics. By the way I didn't want to say that you made a mistake. I'm really grateful that you share it. Great work and you say you did it fast !

But I don't understand how gravity can affect the paddles if the gravity is set to 0.
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Thu May 05, 2016 9:49 pm

The gravity of the green boxes is not set to zero. In fact, it is set to 10 in the layout startup. Wich is perhaps to much too.

Each object has its own personal gravity. Each attached behaviour has its own properties. Its is not 1 3D world.

If you pick out 1 of the green things, and set its gravity to zero, then the others will still fall.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu May 05, 2016 9:50 pm

Ok I understand that, but what about the paddle ?
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Thu May 05, 2016 10:06 pm

The paddle gets pushed away by the weight of the green things.

With its gravity set to zero, it will not fall. It will not feel its own gravity.
It still feels other objects pushing.... feel forces that other objects apply to it.

It does not feel the gravity of the green things, it feels the weight of the green things caused by there gravity.
W = m * g
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu May 05, 2016 10:07 pm

You answer my questions, thank a lot, I think I must find another way because like you said, the paddle are making the square goes through the roof if the paddle come back really fast.

Thanks for taking the time to help me!
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Thu May 05, 2016 10:32 pm

Well i am totaly wrong. You made me doubt myself.

Look at this:

https://drive.google.com/open?id=0B1SSu ... 1A2d3BSRG8

If you change the gravity of 1 object, you change the gravity for all objects.

I apologize for saying dumb things (again).
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 49 guests