[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Tue Sep 08, 2015 2:40 am

how do you force a rotation to a point with this behavior?? ive got overlapping parts all joined together using the physics joints someone posted in this thread but when rotating using built in behavior some of my parts start spazzing out since i guess they need to rotate naturally through physics?

any help would be appreciated :o
B
4
Posts: 27
Reputation: 254

Post » Tue Sep 08, 2015 4:52 am

It probably depends on what you're trying to accomplish. You could try maybe setting the velocity after you rotate it to the velocity it was before the rotation. Maybe setting angular velocity to 0.
Do you want the rotations to have momentum, so after they are rotated they continue moving?
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Tue Sep 08, 2015 10:04 am

Hi. How can I set Chipmunk2D 7.0.1 to construct 2?
B
4
S
2
Posts: 7
Reputation: 468

Post » Tue Sep 08, 2015 10:56 am

navel35 wrote:Hi. How can I set Chipmunk2D 7.0.1 to construct 2?


I assume this is the latest incarnation? If so, you would need to do what R0J0hound has done and use the SDK to integrate it into C2, which is not a small task.

The other option would be for R0J0hound to update his code, but that would be entirely up to him.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
131
S
29
G
81
Posts: 5,328
Reputation: 56,630

Post » Tue Sep 08, 2015 3:20 pm

@jeebroniz
Here's how I would handle rotating to a target angle using torque:

https://dl.dropboxusercontent.com/u/523 ... mping.capx

It uses the same principle as the magnet thing I posted here the other day: apply torque proportional to angle difference of object to target, then add an opposing torque proportional to the object's angular velocity to act as damping.

It'd crude & fairly math-free, but completely force based so won't cause the issues you get when directly setting velocity or position.

Rojo gave a better example here which uses proper torque calcs involving inertia:

viewtopic.php?f=147&t=122190&p=871121&hilit=physics+rotate+towards+angle#p871121

@navel35
Rojo's behavior is built on a javascript port of Chipmunk2d 6.1.1 & I think that's unlikely to get updated.
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Tue Sep 08, 2015 5:00 pm

@navel35
Only version 6.1.1 will probably be used for the lifetime of this plugin. To use version 7, I would have to port it to Javascript myself, but I don't have the time for that. The only additional feature it would have is rounded shapes, but it's not essential.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Sat Sep 12, 2015 1:37 am

I think we as game designers always should pursue for mimicking the reality in most resource-efficient / minimal way... version 6.1.1 of Chipmunk is good enough for many applications... for example, it was used on inBits (and we got very realistic physics in the game) - you can check it out if you live in Brazil, Finland, UK and soon in Japan (we will soft launch the game in Tokyo Game Show).

R0jo got his hands full already, so I for one think he should only continue supporting this version and other works of his. He's done a wonderful job with it =)
B
14
S
3
G
1
Posts: 77
Reputation: 1,035

Post » Mon Sep 14, 2015 4:49 pm

@R0J0hound
I've been trying to make one-way platforms & saw this: https://chipmunk-physics.net/unityDocs/ ... neway.html
Is this possible to set up with a pre-step event?
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Tue Sep 15, 2015 12:58 am

@mattb
I don't think so, at least I can't think of a way off hand.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Wed Sep 16, 2015 6:01 pm

Update 2.3:
+Added "on pre collide" trigger. This is triggered before a collision response occurs. [see note 1]
+Added "ignore collision" action. This only does something under a pre collide trigger.

@mattb
This allows for making a jumpthru behavior.
https://dl.dropboxusercontent.com/u/542 ... pthru.capx

note 1:
From both "pre collide" and "post collide" you can access all the collision expressions, although the impact and KE ones aren't calculated till a post collide.

Also both are subject to a limit in the chipmunk library where nothing can be added or removed form the simulation in them. This behavior works around that by delaying creation and deletion which works most of the time but is the cause of some of the latest bugs.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: rayolf, VickyShiu and 3 guests