[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Sun Sep 20, 2015 7:35 am

I really like the accuracy of chipmunk physics compared to Box2D in most of the aspects (especially the way collisions happen). Thanks a lot for giving us this plugin...

@R0J0hound, I wanted to show how the things around look like from a moving object (that has a behavior of chipmunk physics). More like a relative motion where I change the reference frame to a moving object...For example, the way the objects in the scene appear if I sit on a moving swing...

Are the utility expressions "Worldtolocal" and "localtoworld" the ones that I need to use to translate other objects in the scene?
B
84
S
20
G
3
Posts: 337
Reputation: 7,368

Post » Sun Sep 20, 2015 11:18 pm

@kmsravindra
You should be able to do it by scrolling to the object and settig the layout or layer angle to be the same as that object.
B
91
S
31
G
103
Posts: 5,234
Reputation: 67,754


Post » Mon Sep 21, 2015 2:39 am

@kmsravindra
Those two expressions were for use when adding joints. They aren't needed now since I since came up with a better solution.

Basically what they do is this.
"World" is just your standard xy coordinates on the layout.
"Local" is just a position relative to an object's location and rotation. If you're familiar with 3d programs the idea is similar. For example a local position of (100, 0) will always be 100 pixels in front of wherever the sprite is facing.
B
91
S
31
G
103
Posts: 5,234
Reputation: 67,754


Post » Mon Sep 21, 2015 3:10 pm

@R0J0hound

Hi! Do you know how to integrate chipmunks and rts, for units not to walk on top of each other? Thx! xxx
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
21
Posts: 1,966
Reputation: 19,159

Post » Mon Sep 21, 2015 5:01 pm

@megatronx
Probably the same way as with the physics behavior. All physics objects will push out of each other. I haven't tried it so I don't know if there is any fighting between the behaviors that might make the objects jitter.
B
91
S
31
G
103
Posts: 5,234
Reputation: 67,754

Post » Mon Sep 21, 2015 6:15 pm

R0J0hound wrote:@megatronx
Probably the same way as with the physics behavior. All physics objects will push out of each other. I haven't tried it so I don't know if there is any fighting between the behaviors that might make the objects jitter.


I tired setting it up myself, but I can't get it to work. :< Units either fall or overlap each other.
Last edited by megatronx on Mon Sep 21, 2015 6:39 pm, edited 1 time in total.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
21
Posts: 1,966
Reputation: 19,159

Post » Mon Sep 21, 2015 6:38 pm

@megatronx
I guess it doesn't then. The solution would be to move it with physics instead of letting the pathfinder movement do it. You'll have to use the Sprite.pathfinding.nodexAt and nodeyat expressions to get the points along the path and come up with a way to move along it with physics. That way physics will be in full control of the object's motion and can keep the objects from overlapping.
That's the idea at least. I don't have any working example.
B
91
S
31
G
103
Posts: 5,234
Reputation: 67,754

Post » Mon Sep 21, 2015 9:24 pm

I just tried and found a way to pull the physics object, I posted it in your other thread @megatronx
viewtopic.php?f=147&t=161333&p=978364#p978364
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests