[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Sun Oct 18, 2015 4:55 am

@R0J0hound , post collide only triggers once I think when it first collides, but if the player is standing on the elevator, the elevator would need to continuously negate the forces pushing down on it. I tried anyways, but elevator just gets pushed down.
I also tried the foreach collision pair, and seeing if I could negate forces, but didn't have any success with that.
I've also tried using another object to position the elevator to as a way to keep the elevator from moving, but then it causes objects to sink into it. I assume because it is still getting pushed but the position becomes reset.
:
edit: also, another reason not to use joints is if the elevator must change direction while moving.
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

Post » Sun Oct 18, 2015 12:18 pm

Thank you @R0J0hound and @Prominent . I'll try and compare both methods, but I think you're probably right and going physics all the way is the best way to go. I'm new to Chipmunk Physics so it's all quite intimidating and I will need to find good tutorials / examples to get started, but if I can get it to work it should help fix a couple of other problems I'm currently facing with my game idea. Thanks again!
B
35
S
10
G
4
Posts: 149
Reputation: 4,559

Post » Sun Oct 18, 2015 1:49 pm

@prominent
@waltuo

I posted this a few pages back, might be useful: https://dl.dropboxusercontent.com/u/523 ... pe_v2.capx

The elevator/moving platform thing, i just did that by giving it a high mass & directly setting velocity, there didn't seem to be any problems with deflection on impact, & when it stops moving it's set to immovable.
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Sun Oct 18, 2015 2:46 pm

@mattb That looks great and will no doubt help me in understanding how to use physics instead of platform behavior in my project! I will definitely be studying this, thank you!
B
35
S
10
G
4
Posts: 149
Reputation: 4,559

Post » Sun Oct 18, 2015 5:30 pm

mattb wrote:The elevator/moving platform thing, i just did that by giving it a high mass & directly setting velocity, there didn't seem to be any problems with deflection on impact, & when it stops moving it's set to immovable.


That method places limitations on what I can do. I'm trying to find a solution that maintains all the physics qualities but can cancel out forces from specific objects.
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

Post » Sun Oct 18, 2015 7:13 pm

@R0J0hound , I just noticed that if both objects colliding have prevent rotation set to Yes, the collisionImpactX and Y always return 0.
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

Post » Sun Oct 18, 2015 7:22 pm

@prominent
Here's an idea using collision layers. The idea is the elevator is two different objects on different layers so they don't interact. So for example the orange blocks can affect the elevators motion, whereas the blue one thinks it has high mass.
https://dl.dropboxusercontent.com/u/542 ... ator2.capx

Outside of that idea more of chipmunk's collision handlers would need to be exposed. Then maybe tricks like setting the mass high temporarily before the collision is resolved and then setting it back afterwards could be used.
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Sun Oct 18, 2015 8:04 pm

@R0J0hound , ah! thanks. I was able to apply those concepts to my project, and it's working now!
Just curious though if you know, why would the collisionImpactY return 0 if rotations are prevented?
B
45
S
21
G
65
Posts: 1,118
Reputation: 38,227

Post » Sun Oct 18, 2015 9:53 pm

@prominent
Not sure. All prevent rotation really does is give the object super high rotational inertia.
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Wed Oct 21, 2015 11:26 am

Once again, R0J0Hound dishing out the tasty treats. Thanks for the great behaviour!
B
8
S
2
Posts: 17
Reputation: 579

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: cjbruce and 4 guests