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 [2020/08/21 06:05 (5 years ago)] – ↷ Page moved from en:tutorials:creating_an_insect_object to en:tutorials:physics:creating_an_insect_object sausage | 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 18: | Line 18: | ||
<code ini> | <code ini> | ||
[InsectObject] | [InsectObject] | ||
- | Graphic | + | AnimationSet |
- | AnimationSet | + | |
- | Position | + | |
Body = InsectBody | Body = InsectBody | ||
ChildList | ChildList | ||
ChildJointList | ChildJointList | ||
FXList | FXList | ||
- | Scale = 0.5 | + | Scale |
- | + | ||
- | [InsectGraphic] | + | |
- | Texture | + | |
- | Pivot = center | + | |
- | TextureSize | + | |
</ | </ | ||
- | 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> | ||
- | [InsectFly1@InsectGraphic] | + | [InsectAnimationSet] |
- | TextureOrigin | + | Texture |
- | TextureSize | + | FrameSize |
- | + | KeyDuration | |
- | [InsectFly2@InsectGraphic] | + | StartAnim |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly3@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly4@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly5@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly6@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly7@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly8@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly9@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | [InsectFly10@InsectGraphic] | + | |
- | TextureOrigin | + | |
- | TextureSize | + | |
- | + | ||
- | + | ||
- | [InsectFlyAnim] | + | |
- | DefaultKeyDuration | + | |
- | KeyData1 | + | |
- | KeyData2 | + | |
- | KeyData3 | + | |
- | KeyData4 | + | |
- | KeyData5 | + | |
- | KeyData6 | + | |
- | KeyData7 | + | |
- | KeyData8 | + | |
- | KeyData9 | + | |
- | KeyData10 | + | |
- | + | ||
- | + | ||
- | [InsectAnimationSetAll] | + | |
- | AnimationList | + | |
- | LinkList | + | |
- | + | ||
- | [InsectFlyLoop] | + | |
- | Source | + | |
- | Destination | + | |
</ | </ | ||
Line 118: | Line 54: | ||
StartTime | StartTime | ||
EndTime | EndTime | ||
- | StartValue | + | EndValue |
- | EndValue | + | |
Period | Period | ||
- | Absolute | ||
</ | </ | ||
Line 131: | Line 65: | ||
[InsectWeightObject] | [InsectWeightObject] | ||
Body = InsectWeightBody | Body = InsectWeightBody | ||
- | Position | ||
- | UseParentSpace | ||
- | UseRelativeSpeed= true | ||
[InsectWeightBody] | [InsectWeightBody] | ||
PartList | PartList | ||
Dynamic | Dynamic | ||
- | FixedRotation | ||
HighSpeed | HighSpeed | ||
AngularDamping | AngularDamping | ||
Line 145: | Line 75: | ||
[InsectWeightBodyPart] | [InsectWeightBodyPart] | ||
Type = box | Type = box | ||
- | TopLeft | + | TopLeft |
- | BottomRight | + | BottomRight |
- | Restitution | + | |
- | Friction | + | |
Solid = false | Solid = false | ||
Density | Density | ||
Line 154: | Line 82: | ||
[InsectBodyRevoluteJoint] | [InsectBodyRevoluteJoint] | ||
Type = revolute | Type = revolute | ||
- | ParentAnchor | + | ParentAnchor |
- | ChildAnchor | + | ChildAnchor |
- | Collide | + | |
</ | </ | ||
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 167: | Line 92: | ||
<code ini> | <code ini> | ||
[Border] | [Border] | ||
- | Body = BorderBody | + | Body = BorderBody |
- | Position = (0, 0, 0) | + | Position |
[BorderBody] | [BorderBody] | ||
PartList | PartList | ||
- | Dynamic | ||
FixedRotation | FixedRotation | ||
Line 182: | Line 106: | ||
[BorderBodyPartTop@BorderBodyDefaults] | [BorderBodyPartTop@BorderBodyDefaults] | ||
- | TopLeft | + | TopLeft |
- | BottomRight | + | BottomRight |
[BorderBodyPartLeft@BorderBodyDefaults] | [BorderBodyPartLeft@BorderBodyDefaults] | ||
- | TopLeft | + | TopLeft |
- | BottomRight | + | BottomRight |
[BorderBodyPartRight@BorderBodyDefaults] | [BorderBodyPartRight@BorderBodyDefaults] | ||
- | TopLeft | + | TopLeft |
- | BottomRight | + | BottomRight |
[BorderBodyPartBottom@BorderBodyDefaults] | [BorderBodyPartBottom@BorderBodyDefaults] | ||
- | TopLeft | + | TopLeft |
- | BottomRight | + | BottomRight |
</ | </ | ||
Line 211: | Line 135: | ||
PartList | PartList | ||
Dynamic | Dynamic | ||
- | FixedRotation | ||
HighSpeed | HighSpeed | ||
AngularDamping | AngularDamping | ||
Inertia | Inertia | ||
- | CustomGravity | + | CustomGravity |
[InsectBodyPart] | [InsectBodyPart] | ||
Type = box | Type = box | ||
- | TopLeft | + | TopLeft |
- | BottomRight | + | BottomRight |
SelfFlags | SelfFlags | ||
CheckMask | CheckMask | ||
Restitution | Restitution | ||
Friction | Friction | ||
+ | Density | ||
Solid = true | Solid = true | ||
- | Density | ||
</ | </ | ||
- | {{ 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: |