This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:tutorials:physics:creating_an_insect_object [2024/05/07 22:13 (12 months ago)] – Updated Gravity iarwain | en:tutorials:physics:creating_an_insect_object [2024/05/08 00:09 (12 months ago)] (current) – Typo fix iarwain | ||
---|---|---|---|
Line 11: | Line 11: | ||
<code ini> | <code ini> | ||
[Physics] | [Physics] | ||
- | Gravity | + | Gravity |
</ | </ | ||
Line 19: | Line 19: | ||
[InsectObject] | [InsectObject] | ||
AnimationSet | AnimationSet | ||
- | Position | ||
Body = InsectBody | Body = InsectBody | ||
ChildList | ChildList | ||
Line 27: | Line 26: | ||
</ | </ | ||
- | Next the animation so that the insect beats his wings over and over: | + | Next the animation so that the insect beats its wings over and over: |
<code ini> | <code ini> | ||
[InsectAnimationSet] | [InsectAnimationSet] | ||
Texture | Texture | ||
- | FrameSize | + | FrameSize |
KeyDuration | KeyDuration | ||
StartAnim | StartAnim | ||
Line 66: | Line 65: | ||
[InsectWeightObject] | [InsectWeightObject] | ||
Body = InsectWeightBody | Body = InsectWeightBody | ||
- | Position | ||
[InsectWeightBody] | [InsectWeightBody] | ||
Line 84: | Line 82: | ||
[InsectBodyRevoluteJoint] | [InsectBodyRevoluteJoint] | ||
Type = revolute | Type = revolute | ||
- | ParentAnchor | + | ParentAnchor |
- | ChildAnchor | + | ChildAnchor |
</ | </ | ||
Notice the weight body is dynamic so it will be affected by gravity. The physics will be pushing down on the weight, but the speed movements of the insect will compensate and create more randomness to the movement. The revolute joint will keep the weighted object at the bottom, eventually straightening the insect if it is upside down. | Notice the weight body is dynamic so it will be affected by gravity. The physics will be pushing down on the weight, but the speed movements of the insect will compensate and create more randomness to the movement. The revolute joint will keep the weighted object at the bottom, eventually straightening the insect if it is upside down. | ||
- | |||
- | With the joint, it has been set so that the weight object can pass thought the insect using //Collide = false// if they collide. | ||
If the insect flies off the screen, we may never see it again. So perhaps a border around the screen is in order. That will keep the insect on the screen: | If the insect flies off the screen, we may never see it again. So perhaps a border around the screen is in order. That will keep the insect on the screen: | ||
Line 97: | Line 93: | ||
[Border] | [Border] | ||
Body = BorderBody | Body = BorderBody | ||
- | Position | + | Position |
[BorderBody] | [BorderBody] | ||
Line 146: | Line 142: | ||
[InsectBodyPart] | [InsectBodyPart] | ||
Type = box | Type = box | ||
- | TopLeft | + | TopLeft |
- | BottomRight | + | BottomRight |
SelfFlags | SelfFlags | ||
CheckMask | CheckMask | ||
Line 153: | Line 149: | ||
Friction | Friction | ||
Density | Density | ||
+ | Solid = true | ||
</ | </ | ||
- | {{ tutorials: | + | And run that up. The insect should be fluttering nicely around the place. You can run with '' |
- | And run that up. The insect | + | {{ tutorials: |