How do I create this physics which affects...

Get help using Construct 2

Post » Tue Jun 24, 2014 4:56 am

Hi everyone,

How to create a physics where the cannon shooting affects the cannon base and wheels movements like in the image below.

Now I know pinning the base obj to the cannon and physics applied. But how does the wheel rotates
You do not have the required permissions to view the files attached to this post.
Image
B
32
S
7
Posts: 197
Reputation: 2,527

Post » Tue Jun 24, 2014 12:00 pm

In theory if your objects have the correct mass, you can just apply the same force on the cannon as the cannonball, but at the opposite angle.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Tue Jun 24, 2014 12:44 pm

I don't understand clearly. I actually need something like the sample game from this post.
parabola-tracjectory-tracing-with-physics-box2d_t77802?&hilit=trajectory&start=20

This sample game by @johnnysix

http://www.johnnysix.net/games/ParabolaTank/ - the cannon responds for the shooting pressure and angle and also the wheel spins.

Thanks @johnnysix for this wonderful reference
Image
B
32
S
7
Posts: 197
Reputation: 2,527

Post » Wed Jun 25, 2014 10:50 am

I tried what I said before and it worked. Are you thinking of something different? What they were talking about in that thread was parabola movement, not 'recoil'.

Here's an example:
on mouse clicked:
 ・ create object "cannonball"
 ・ apply impulse 1 to cannonball at angle(cannon.x,cannon.y,mouse.x,mouse.y)
 ・ apply impulse 1 to cannon at angle(cannon.x,cannon.y,mouse.x,mouse.y) + 180
This works with some changes to the mass of both objects.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Wed Jun 25, 2014 11:59 am

Thanks mate....I will try what u said as soon as I reach home........

By the way about that thread i just wanted you to understand what I am looking for by that sample game in that thread and not that entire thread.

You can see the cannon moves based on the pressure and also the wheel spins.
Image
B
32
S
7
Posts: 197
Reputation: 2,527

Post » Wed Jun 25, 2014 12:18 pm

As for the wheels, it's as simple as don't use pin behavior. Unfortunately it conflicts with physics. For a wheel though you can just set a physics joint (it's an action). You can try with the different types of joints, that should fix any conflicts.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Wed Jun 25, 2014 12:20 pm

Could u post a sample capx mate?
Image
B
32
S
7
Posts: 197
Reputation: 2,527

Post » Wed Jun 25, 2014 9:54 pm

Here you go, have a look at the capx, the key for this sample to work is the ratio between the "Ball" density and the "Base" density, so applying the same impulse(inverted) to both of them gives a diferent effect (action/reaction).
Edit: the wheels are just round objects attached by a joint to the base, so when they suffer from the impulse they spin without any other worries.
You do not have the required permissions to view the files attached to this post.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Thu Jun 26, 2014 4:46 am

Thanks mate. I see what you have done there. I made changes and checked how both impulse works and how the joint works for the wheel.

Thanks a lot for the help @caiorosisca and @Sumyjkl
Image
B
32
S
7
Posts: 197
Reputation: 2,527


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests