Hey Guys, I can't seem to find the way to set "Fixed Rotation" for a physics object. Aka I would like to make sure the image is always upright no matter what. So for example if there is an object that slides down on a slope, I wanto to make sure it will never ever roll. Is this possible? Thanks! Tamas
WOW, if I do remember my physics days, I don't see how this will be possible except your object has a LOW centre of Gravity and the angle of slope will matter also. What type of object are you trying to achieve this on?
I know, I am always surprised when Box2D, Chipmunk and other physics engine does not let you to do limitations like that. For non-BB games I had to patch Chipmunk in the other day, I was just hoping BB has already done that. It is an enemy type. It is a ball actually but the graphics is not flat so it does not look good when rotates. Maybe I will try to make it as a non physics object and attach to it a wheel, hope that works.
Ok, here is the mini-tutorial Problem: Enemy is a physics object, so it falls and on a slope it slides. But as it does that, it is tilted by the slope: This might be the behavior you may want most of the time, but what if not? I have not found any settings similar to character to say "fixed rotation". This is what I wanted to achieve: My solution was this: I have added a wheel: Now I have attached it to the enemy and set both Speed and Torque to 0 for the link (maybe this can be omitted). Make sure you start the link from the wheel so that the enemy will be the child... Then positioned the wheel exactly in the middle of the enemy object: For the wheel object I have opened the physics shape editor: And by default the shape is a rectangle like this: But you may need a circular one: From now you should be able use your enemy like that, however, the wheel is visible: So click on the wheel and "send it back" -- In other words make sure that is behind the enemy object, so you will not see that: If everything went as planned, you should be able to get the desired result: Tamas
Thanks guys! BTW you do not have to go very far with your imagination where it could be useful. For example your character has the fixed rotation set and it meets the enemy on the slope. If the enemy is tilted but your character is not, it may look funny: Or if you have a ball that has a non-flat color, like a color graduation or shine on it to look like a real ball, then it looks awful if it rotates down on the slope (maybe the still image does not seem to very bad but when it animates, believe me the effect is terrible): And even worse if the enemy object is not completely round, like a bomb: If you use rectangular collision shape, it may not roll but just tilts and slides on the slope, which might be acceptable, however, it may can roll over if hits a little bump at the end of the slope.
Just a question guys is there a way to set the weight of your physics object or are they all set the same. I'm trying to do a springboard effect.?
Thanks for the info, so I could link two physics objects together and make it heavier, just use a single pixel PNG with a big collision shape to hide the 2nd object. Cheers
Exactly, you can also remove the default animation (single pixel sprite) when you have defined the collision shape, but after that you cannot edit that anymore unless you re-add a sprite.