Can we get way to check number of joints a physics obj has?

Get help using Construct 2

Post » Mon Nov 17, 2014 11:09 pm

If there was a way to check how many joints a physics object has currently, that would be great.
At the moment, when you create a joint, it isn't instantly added, and you have to wait a bit before the physics gets updated. I think it's the same case when creating instances of physics objects.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Thu Nov 20, 2014 10:39 am

Hi Prominent. Are the joints created dynamically in your game?
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Thu Nov 20, 2014 6:07 pm

hundredfold, joints can only be made one way.
There's no way of knowing if the joint has been made yet, though, which can give you in-adverse effects if you need to carry out an operation based on that information. It won't work if you just set a variable when you add the joint, because the joint won't be made exactly when the variable is set.

physics updates every tick before the events are ran. Is this the case for joints (because it doesn't appear to be)? Do joints get created when a physics object is created, or do they get added after they get created, and if so, when?
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Thu Nov 20, 2014 6:20 pm

I don't think there is any delay creating or joining a joint, at least, the way I did it for my Stickman game.

For me it was like:

On Enemy Created:
Enemy.spawn Leg1
Enemy.Create Revolute Joint at ImagePoint1 to Leg1
Leg1.setAngle to 240 degrees

Now, if my Leg1 had any delay in getting created or joined, then its SetAngle of 240 degrees command would automatically be skipped, but it didn't. Which means it used to create the joint instantly, then also goes and follows the next Action.

You can easily have an "Add to" variable (of Joints), after the "Create revolute joint" and it will be executed accordingly.
Last edited by Hasan999 on Thu Nov 20, 2014 6:24 pm, edited 1 time in total.
B
10
S
2
Posts: 107
Reputation: 978

Post » Thu Nov 20, 2014 6:24 pm

@Prominent Thanks, I think I need to play around with joints a little more to better understand them.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Thu Nov 20, 2014 7:46 pm

Hasan999, the reason why the angle is set is because setAngle has no relation to physics- hence it doesn't need to wait for physics operations. What I'm asking about is related to the implementation of the physics and how the joints get updated.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Wed Dec 31, 2014 4:08 am

Sorry to ressurect this topic.

But is there a way I can do this?

In my case i'm adding a joint to a circle on collision. And I need to keep track of how many objects are attached to the circle.

The issue is, that i'm using on collision to create the revolute joint, but since the object keeps colliding, if I use add to to keep track it will add constantly.

Thanks
B
7
S
1
Posts: 27
Reputation: 479


Return to How do I....?

Who is online

Users browsing this forum: mrkaio, muquia, tarek2 and 2 guests