Space Man Game Question

41 views
Skip to first unread message

sumowrestler

unread,
Mar 1, 2017, 12:12:34 PM3/1/17
to Nape Physics
Scenario:
- Suppose I want to have a space man that floats in space (gravity=0)
- He is movable (Dynamic) 
- When he collides with any walls (Static) in space, he should not bounce but stay touching the wall until he chooses to move away.

Is there any material or method I can use that won't cause him to bounce?

I tried a PreInterceptor that disables his speed on contact, but then he can't move away.

Ideas welcome, thanks in advance.

Sumo

Noah Rosenfield

unread,
Mar 1, 2017, 1:10:03 PM3/1/17
to Nape Physics
I'd probably choose to do it by checking collisions and setting the body to static until the user input is received (assuming that's how he moves away). Then set him back to dynamic and apply the force.

If you still wanted some kind of "floaty-esque" movement when he hits the wall, put a semi-flexible distance joint on him and disable it. Every time he hits a wall, attach the other side of the joint to the wall he hits (or just a world point that coincides with his current position) and enable the joint. Disable the joint on user input.

sumowrestler

unread,
Mar 4, 2017, 4:35:55 AM3/4/17
to Nape Physics
Hi Noah!,

Yes ! - you are right the hero moves on user input and this worked perfectly! I didn't realise I could change the body type.

I only needed to make sure that I change the body type after of space.step and space.liveBodies.foreach() otherwise hero would yoyo.

Thanks for your help, much appreciated !.

Sumo



Reply all
Reply to author
Forward
0 new messages