Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Weld Joint Issue

Author
Message
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 24th Jun 2015 23:56
I've been trouble-shooting a weld joint issue all night, which I have gotten to work before without problems. The issue turned out to be SetSpritePhysicsCanRotate(id, 0), not allowing the sprites to rotate makes the joint not work at all.

Is it meant to work like that? If so I'll have to work around it

My hovercraft is full of eels
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 25th Jun 2015 00:00
Funnily enough, 5 mins after I posted this I found a solution:

If you have a chain of welded together sprites, only setting one of these to NOT rotate will not break the weld joints. They do jiggle about a bit and stretch the joints when moved but it looks kinda sexy

My hovercraft is full of eels
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 28th Jun 2015 11:12
I know noone cares but it would be nice to know if this is a feature in box2d or a bug in AGK.

Setting sprites to not be allowed to rotate breaks weld joints

My hovercraft is full of eels
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 29th Jun 2015 16:50
Sounds reasonable to me. If you have a sprite that can't rotate and you try to rotate it with a weld joint, the join should break right?

Do you have small code example of what you are trying to achieve that you could share?

V2 T1 (Mostly)
Uzmadesign
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 29th Jun 2015 22:40
Yeah I'll set up an example when I have time thanks

My hovercraft is full of eels
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 29th Jun 2015 23:03


There, I've included the exe in this post as well if someone doesn't feel like compiling it

My hovercraft is full of eels

Attachments

Login to view attachments
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 29th Jun 2015 23:05
Example 2 is the workaround I'm using. But it's not good, because in the app I'm making lines are deleted (think tetris) and if the none-rotating sprite is deleted in a chain the others start spinning

My hovercraft is full of eels
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 2nd Jul 2015 13:58
Just so everybody knows.. this is highly annoying.

The joints give an unpredictable result, 9 times out of 10 they work, then all of a sudden one joint is missing and it breaks the game. I think it has to do with having one sprite in the group not rotate but I still haven't found out if that is a feature of box2d or a bug in AGK. Probably never will find out and will have to redo this without physics.

This thread is like a diary at this point

Yes I'm annoyed as I'm writing this, sorry

My hovercraft is full of eels
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Jul 2015 16:15
This is not a bug. When you have two none rotating sprites welded together any forces that act upon those sprites are massively multiplied. You are effectively taking something that can't rotate, welding it to another something that can't rotate and then any force applied to one of those objects creates a torque force on the other.

You should consider positioning a dummy none rotating sprite where the (invisible) rotating physics sprite is manually each loop.

I often find that you have to think outside the box with box2d to get the result you are imagining.

I will take a look at your code when I get the chance and see if I can help a little more.

Using AppGameKit V2 Tier 1
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 2nd Jul 2015 19:45
I considered that, but I can always grab a made shape with the mouse joint and shake it about however much I want. It's when they are made one joint is missing in the link of the shape.

The above code is only an example of how you cannot have every sprite in a chain of sprites set to not rotate. If you want I can mail you my main project where the problem actually occurs.

I supposed there could be some kind of jolt when the joint is made that breaks it right away.

My hovercraft is full of eels
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 3rd Jul 2015 01:43
Solved some of the issues with the joints breaking.

Still not liking what happens in the example above, but I guess it's a feature of box2d and I'll have to live with it

My hovercraft is full of eels
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Jul 2015 12:43
Just testing your code but I don't understand what you are trying to achieve? Examples 1 and 2 work exactly as I would expect. 3 is pretty bizarre but maybe not completely surprising as you have a pretty odd situation there...

I did notice that if you use createRevoluteJoint rather than createWeldJoint you can set all sprites to not rotate with no bugs although I have no idea if that's what you wanted?

Using AppGameKit V2 Tier 1
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 5th Jul 2015 12:37
In my mind example 3 should look exactly like example 2?

My hovercraft is full of eels
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 5th Jul 2015 12:39
The whole point is to have a chain of sprites that do not rotate, even if one is later broken off from the chain. Which doesn't happen in example 2, only one sprite of those five doesn't rotate

My hovercraft is full of eels
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 5th Jul 2015 12:40
I don't see how its odd to have five sprites welded together and they cant rotate? How would that produce what happens in example 3?

Baffled

My hovercraft is full of eels
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Jul 2015 00:16
I still don't get what you are trying to achieve?

Using AppGameKit V2 Tier 1
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 6th Jul 2015 07:04 Edited at: 6th Jul 2015 07:05
It was supposed to be a simple way to have a chain of sprites the user can manipulate. Sprites can be broken off from the chain via the user, and they are not supposed to rotate when this happens, no matter if one or more breaks off.

I fail to see anything weird or unusual about it whatsoever. Physics sprites not allowed to rotate, with joints.


Edit: I already have a working workaround for what I want to achieve, but the above would have made it simpler

My hovercraft is full of eels
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Jul 2015 09:50
As far as I can tell using revolute joints as I suggested gives you a chain of none rotating sprites that the user could manipulate. Breaking individual sprites off would break the chain at that point but I'm not quite sure how you would want that to work.

The main question I have is about the chain, are you wanting the chain to rotate but the sprites to not rotate?

Glad you found a workaround because I still don't really get what you are trying to do. I get the feeling if I understood I'd be able to provide a solution.

Using AppGameKit V2 Tier 1
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 6th Jul 2015 22:11
I'm sure you could, that is why I mentioned a workaround. Thank you.

I don't want the shape to rotate, I wanted it to act exactly like example 2 that I posted but with the difference if one or two sprites are broken off the chain they should not rotate either, which they would in example 2.

I might give the revolute joint a try if my workaround gives me trouble. Thanks for finding that. To me it is still baffling that example 3 happens like it does

My hovercraft is full of eels
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Jul 2015 23:50
Box2d is a little twitchy...

Using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-11-16 18:09:09
Your offset time is: 2024-11-16 18:09:09