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 / Soft Body: Prismatic Joint Errors

Author
Message
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 15th Feb 2014 21:33 Edited at: 22nd Feb 2014 19:38

First of all, if you play with the frame rate cap (I'd suggest uncapping to see the problem) It seems that prismatic joints are not timer based within the physics engine. At high frame rates the sphere is no longer squishy. Not only that, but prismatic joints constantly cause crashing. The crashes are quite erratic, but tend to occur when, for whatever reason, the outer bodies explode. (This behavior still occurs without the distance joints) The numbers I've used at the moment are the most stable, but if the /5.0 is removed from the creation of these joints, the program instantly freezes. (Perhaps I don't understand the actual meaning of vx and vy?) If the size of the outer spheres is reduced the program crashes as well as when the joint limit has different values (different how? I'm not really quite sure). Does anyone know what could be causing this?

I'm running on AppGameKit 1v21



Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Feb 2014 22:49
Your signature hurts my eyeballs

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 17th Feb 2014 01:30
I'm impressed you were even able to achieve soft bodies of any kind given AGK's still very much incomplete Box2D implementation. Sorry can't help any as I've been waiting for a 100% Box2D implementation to play with it here.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Feb 2014 09:26 Edited at: 17th Feb 2014 09:27
Could it be that it is expecting radians rather than degrees? I know that physics joint limits require radians...

EDIT: nevermind I just read the code. Should have done that first

oct(31) = dec(25)
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 18th Feb 2014 03:13
Also just noticed you can't use setJointLimitOn() with line joints despite this from the documentation on the command,
Quote: "Works on Line joints, Prismatic joints, and Revolute joints"

I get an error saying the joint type isn't supported.

Quote: "Your signature hurts my eyeballs"

It was from the eyeball burning thread

Quote: "I'm impressed you were even able to achieve soft bodies of any kind given AGK's still very much incomplete Box2D implementation. Sorry can't help any as I've been waiting for a 100% Box2D implementation to play with it here. "

I was surprised to get it working too! Although I shouldn't really say working

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 22nd Feb 2014 19:32 Edited at: 22nd Feb 2014 19:44
Sorry to double post, but the content differs here and I wanted to separate it.

Does anyone have any ideas as to how I should fill the soft body(visually that is)? Using memblocks to build an image every frame would be too slow I assume, but I can't think of a good way to do it with sprites. The body turning concave is a big issue some members seem to have come up with some clever tricks for these kinds of issues in the past so I figured I'd open it up I'll post a picture in the OP so what I'm asking is clearer. Essentially the goal is to make the wire frame blob a solid.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Feb 2014 00:26
I have an interesting, yet somewhat complex, method of filling your soft body. (i should really reword that...)


The body is basically a tightly packed set of triangles which forms the circular shape. You could either write a function to draw triangles and use that to fill the body, or make each segment in the shape a sprite and carefully adjust the UV coordinates.

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 25th Mar 2014 21:29
I had considered a method somewhat like that but AppGameKit interpreted math is quite slow :/ I'm worried all the work would produce a disappointing result. Then again I'm not sure what would be better.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Mar 2014 01:17
I wonder if you could use sprites. Move the bottom UV coords together to form the triangle, make that corner the point of rotation, then rotate accordingly. That would probably be faster than drawing filled triangles, but I'm not sure how well the edges would fit together.

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 26th Mar 2014 15:51
I get 630 frames compared to 1950 when now drawing the polygon at all, but this method is at least interesting. For the time being I adapted an algorithm that can draw any polygon (convex or concave).

This is it on its own. s[] is an array of sprites that represent the edge points. (note that your virtual resolution has to match your actual one)


and now here's the code as a whole. I can't seem to make the soft body any bigger or AppGameKit crashes... even if I change the physics scale :s



I'll have to give that sprite technique a try too

Login to post a reply

Server time is: 2024-05-05 07:56:49
Your offset time is: 2024-05-05 07:56:49