User Tools

Site Tools


en:tutorials:physics:creating_an_insect_object

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:tutorials:physics:creating_an_insect_object [2020/08/21 06:05 (4 years ago)] – ↷ Page moved from en:tutorials:creating_an_insect_object to en:tutorials:physics:creating_an_insect_object sausageen:tutorials:physics:creating_an_insect_object [2024/05/08 00:09 (5 months ago)] (current) – Typo fix iarwain
Line 11: Line 11:
 <code ini> <code ini>
 [Physics] [Physics]
-Gravity             = (0.0, 1000.0, 0.0)   +Gravity         = (0, 1000)   
 </code> </code>
  
Line 18: Line 18:
 <code ini> <code ini>
 [InsectObject] [InsectObject]
-Graphic         = InsectGraphic ; Optional. Supplies the default frame size for all animations. +AnimationSet    = InsectAnimationSet
-AnimationSet    = InsectAnimationSetAll +
-Position        = (400, 300, -0.1)+
 Body            = InsectBody Body            = InsectBody
 ChildList       = InsectWeightObject ChildList       = InsectWeightObject
 ChildJointList  = InsectBodyRevoluteJoint ChildJointList  = InsectBodyRevoluteJoint
 FXList          = InsectMovementFX FXList          = InsectMovementFX
-Scale = 0.5 +Scale           = 0.5
- +
-[InsectGraphic] +
-Texture         = insect-drone.png +
-Pivot           = center +
-TextureSize     = (157, 122, 0)+
 </code> </code>
  
-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   (0, 0, 0) +Texture         insect-drone.png 
-TextureSize     = (157, 122, 0+FrameSize       = (157, 122) 
- +KeyDuration     = 0.01 
-[InsectFly2@InsectGraphic] +StartAnim       = Fly
-TextureOrigin   = (157, 0, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly3@InsectGraphic] +
-TextureOrigin   = (314, 0, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly4@InsectGraphic] +
-TextureOrigin   = (471, 0, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly5@InsectGraphic] +
-TextureOrigin   = (628, 0, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly6@InsectGraphic] +
-TextureOrigin   = (0, 122, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly7@InsectGraphic] +
-TextureOrigin   = (157, 122, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly8@InsectGraphic] +
-TextureOrigin   = (314, 122, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly9@InsectGraphic] +
-TextureOrigin   = (471, 122, 0) +
-TextureSize     = (157, 122, 0) +
- +
-[InsectFly10@InsectGraphic] +
-TextureOrigin   = (628, 122, 0) +
-TextureSize     = (157, 122, 0) +
- +
- +
-[InsectFlyAnim] +
-DefaultKeyDuration = 0.01 +
-KeyData1        = InsectFly1 +
-KeyData2        = InsectFly2 +
-KeyData3        = InsectFly3 +
-KeyData4        = InsectFly4 +
-KeyData5        = InsectFly5 +
-KeyData6        = InsectFly6 +
-KeyData7        = InsectFly7 +
-KeyData8        = InsectFly8 +
-KeyData9        = InsectFly9 +
-KeyData10       = InsectFly10 +
- +
- +
-[InsectAnimationSetAll] +
-AnimationList   = InsectFlyAnim +
-LinkList        = InsectFlyLoop +
- +
-[InsectFlyLoop] +
-Source          = InsectFlyAnim +
-Destination     = InsectFlyAnim+
 </code> </code>
  
Line 118: Line 54:
 StartTime       = 1 StartTime       = 1
 EndTime         = 2 EndTime         = 2
-StartValue      = (0, 0, 0) +EndValue        = (-100, -1550) ~ (100, -1550)
-EndValue        = (-100, -1550, 0) ~ (100, -1550, 0)+
 Period          = 4 Period          = 4
-Absolute        = false 
 </code> </code>
  
Line 131: Line 65:
 [InsectWeightObject] [InsectWeightObject]
 Body            = InsectWeightBody Body            = InsectWeightBody
-Position        = (-20, 80, 0) 
-UseParentSpace  = true 
-UseRelativeSpeed= true 
  
 [InsectWeightBody] [InsectWeightBody]
 PartList        = InsectWeightBodyPart PartList        = InsectWeightBodyPart
 Dynamic         = true Dynamic         = true
-FixedRotation   = false 
 HighSpeed       = true HighSpeed       = true
 AngularDamping  = 0.0 AngularDamping  = 0.0
Line 145: Line 75:
 [InsectWeightBodyPart] [InsectWeightBodyPart]
 Type            = box Type            = box
-TopLeft         = (0, 0,0) +TopLeft         = (0, 0) 
-BottomRight     = (50, 50, 0) +BottomRight     = (50, 50)
-Restitution     = 0.75 +
-Friction        = 0.9+
 Solid           = false Solid           = false
 Density         = 1.0 Density         = 1.0
Line 154: Line 82:
 [InsectBodyRevoluteJoint] [InsectBodyRevoluteJoint]
 Type            = revolute Type            = revolute
-ParentAnchor    = (0,55,0+ParentAnchor    = (78.5200;Keep the anchor a good distance below the insect object 
-ChildAnchor     = (0,-10,0) +ChildAnchor     = (0, 0)
-Collide         = false+
 </code> </code>
  
 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 = (00, 0)+Position        = (-400-300;top-left of the border area
  
 [BorderBody] [BorderBody]
 PartList        = BorderBodyPartTop # BorderBodyPartRight # BorderBodyPartBottom # BorderBodyPartLeft PartList        = BorderBodyPartTop # BorderBodyPartRight # BorderBodyPartBottom # BorderBodyPartLeft
-Dynamic         = false 
 FixedRotation   = true FixedRotation   = true
  
Line 182: Line 106:
  
 [BorderBodyPartTop@BorderBodyDefaults] [BorderBodyPartTop@BorderBodyDefaults]
-TopLeft         = (0, 0, 0) +TopLeft         = (0, 0) 
-BottomRight     = (800, 20, 0)+BottomRight     = (800, 20)
  
 [BorderBodyPartLeft@BorderBodyDefaults] [BorderBodyPartLeft@BorderBodyDefaults]
-TopLeft         = (0, 0, 0) +TopLeft         = (0, 0) 
-BottomRight     = (20, 600, 0)+BottomRight     = (20, 600)
  
 [BorderBodyPartRight@BorderBodyDefaults] [BorderBodyPartRight@BorderBodyDefaults]
-TopLeft         = (780, 0, 0) +TopLeft         = (780, 0) 
-BottomRight     = (800, 600, 0)+BottomRight     = (800, 600)
  
 [BorderBodyPartBottom@BorderBodyDefaults] [BorderBodyPartBottom@BorderBodyDefaults]
-TopLeft         = (0, 580, 0+TopLeft         = (0, 580) 
-BottomRight     = (800, 600, 0+BottomRight     = (800, 600) 
 </code> </code>
  
Line 211: Line 135:
 PartList        = InsectBodyPart PartList        = InsectBodyPart
 Dynamic         = true Dynamic         = true
-FixedRotation   = false 
 HighSpeed       = true HighSpeed       = true
 AngularDamping  = 0.0 AngularDamping  = 0.0
 Inertia         = 0.0 Inertia         = 0.0
-CustomGravity   = (0, 0, 0)+CustomGravity   = (0, 0)
  
 [InsectBodyPart] [InsectBodyPart]
 Type            = box Type            = box
-TopLeft         = (-78.5,-31,0+TopLeft         = (0, 31) 
-BottomRight     = (78.561, 0)+BottomRight     = (157122)
 SelfFlags       = insect SelfFlags       = insect
 CheckMask       = border CheckMask       = border
 Restitution     = 0.75 Restitution     = 0.75
 Friction        = 0.9 Friction        = 0.9
 +Density         = 1.0
 Solid           = true Solid           = true
-Density         = 1.0 
 </code> </code>
  
-{{ tutorials:animation:insect.gif |}} +And run that up. The insect should be fluttering nicely around the place. You can run with ''ShowDebug = true'' in the ''[Physics]'' section, and can check how the weight object is interacting with the insect object
  
-And run that up. The insect should be fluttering nicely around the place.+{{ tutorials:animation:insect.gif?|}} {{ :tutorials:animation:screenshot_2024-05-08_115748.png?450   |}}
en/tutorials/physics/creating_an_insect_object.1598015149.txt.gz · Last modified: 2020/08/21 06:05 (4 years ago) by sausage