| 1.17 Entity . 124 |
| 1.17.1 Entity.ApplyAngularlmpulse . 124 |
| 1.17.2 Entity.Applylmpulse . 124 |
| 1.17.3 Entity.AttachPersonLabel . 125 |
| 1.17.4 Entity.AttachToBone . 125 |
| 1.17.5 Entity.AttachToParent . 126 |
| 1.17.6 Entity.BlendAnimln . 127 |
| 1.17.7 Entity.BlendAnimOut . 128 |
| 1.17.8 Entity.Copy . 129 |
| 1.17.9 Entity.Create . 129 |
| 1.17.10 Entity.CreateForceAction . 130 |
| 1.17.11 Entity.CreatePointForceAction . 131 |
| 1.17.12 Entity.CreateTorqueAction . 131 |
| 1.17.13 Entity.DebugSetAxesVisible . 132 |
| 1.17.14 Entity.DebugSetCollisionVisible . 133 |
| 1.17.15 Entity.DebugSetPlierarchyVisible. 133 |
| 1.17.16 Entity. DestroyAction . 134 |
| 1.17.17 Entity.DetachPersonLabel . 135 |
| 1.17.18 Entity.EnableAction . 135 |
| 1.17.19 Entity.EnableCollision . 136 |
| 1.17.20 Entity.EnableCollisionCallbacks . 136 |
| 1.17.21 Entity.EnableDynamics . 137 |
| 1.17.22 Entity.EnableDynamicsAutoDeactivation . 138 |
| 1.17.23 Entity.EnablelnterpolatedMode . 139 |
| 1.17.24 Entity.EnableKeepUpright . 139 |
| 1.17.25 Entity.EnableLayerCollision . 140 |
| 1.17.26 Entity.EvaluateAnims . 140 |
| 1.17.27 Entity.FindMaterials . 141 |
| 1.17.28 Entity.GetActiveAnim . 142 |
| 1.17.29 Entity.GetAngularDamping . 143 |
| 1.17.30 Entity.GetAngularVelocity . 143 |
| 1.17.31 Entity.GetBoneCount . 144 |
| 1.17.32 Entity.GetBonelndex . 144 |
| 1.17.33 Entity.GetBoneLocalMatrix . 145 |
| 1.17.34 Entity.GetBoneWorldMatrix . 145 |
| 1.17.35 Entity.GetCenterOfMassLocal . 146 |
| 1.17.36 Entity.GetCenterOfMassWorld . 147 |
| 1.17.37 Entity.GetChildren . 147 |
| 1.17.38 Entity.GetCloth . 148 |
| 1.17.39 Entity.GetCollisionLayer . 149 |
| 1.17.40 Entity.GetContactCount . 149 |
| 1.17.41 Entity.GetContactEntity . 150 |
| 1.17.42 Entity.GetContactld . 151 |
| 1.17.43 Entity.GetContactPoint . 151 |
| 1.17.44 Entity.GetContactRelVelocity . 152 |
| 1.17.45 Entity.GetContactUserld . 153 |
| 1.17.46 Entity.GetCullDistance. 153 |
| 1.17.47 Entity.GetGravity . 154 |
| 1.17.48 Entity.GetlndexOfAnim . 155 |
| 1.17.49 Entity.GetLinearDamping . 155 |
| 1.17.50 Entity.GetLinearVelocity . 156 |
| 1.17.51 Entity.GetLocalBounds . 157 |
| 1.17.52 Entity.GetLocalMatrix . 157 |
| 1.17.53 Entity.GetMass . 158 |
| 1.17.54 Entity.GetNumActiveAnims . 158 |
| 1.17.55 Entity.GetParent . 159 |
| 1.17.56 Entity.GetPointVelocity . 160 |
| 1.17.57 Entity.GetPosition . 160 |
| 1.17.58 Entity.GetRotationQuat . 161 |
| 1.17.59 Entity.GetRotationXyz . 161 |
| 1.17.60 Entity.GetScale . 162 |
| 1.17.61 Entity.GetSiblings . 162 |
| 1.17.62 Entity.GetUniqueld . 163 |
| 1.17.63 Entity.GetWorldBounds . 164 |
| 1.17.64 Entity.GetWorldMatrix . 164 |
| 1.17.65 Entity.HasActiveAnims . 165 |
| 1.17.66 Entity.IsActionEnabled . 166 |
| 1.17.67 Entity. IsDynamicsActive . 166 |
| 1.17.68 Entity.IsDynamicsAutoDeactivationEnabled . 167 |
| 1.17.69 Entity.IsinterpolatedModeEnabled . 168 |
| 1.17.70 Entity.IsKeepUprightEnabled . 168 |
| 1.17.71 Entity.IsLayerCollisionEnabled . 169 |
| 1.17.72 Entity.IsVisiblc . 169 |
| 1.17.73 Entity.LookAt . 170 |
| 1.17.74 Entity.LookAtWorld . 170 |
| 1.17.75 Entity.ParticlelsAlive . 171 |
| 1.17.76 Entity.ParticleReset . 172 |
| 1.17.77 Entity.ParticleSetAttachType . 172 |
| 1.17.78 Entity. ParticleSetEffect . 173 |
| 1.17.79 Entity.ParticleSetEmitting . 173 |
| 1.17.80 Entity.ParticleSetUpdate . 174 |
| 1.17.81 Entity.ParticleSetUserParam . 175 |
| 1.17.82 Entity.PauseAnim . 175 |
| 1.17.83 Entity.PlayAnim . 176 |
| 1.17.84 Entity.RegisterCollisionCallback . 177 |
| 1.17.85 Entity.Reset . 177 |
| 1.17.86 Entity.ResumeAnim . 178 |
| 1.17.87 Entity.SetActionForce . 179 |
| 1.17.88 Entity.SetActionPosition . 179 |
| 1.17.89 Entity.SetActionTorque . 180 |
| 1.17.90 Entity.SetAngularDamping . 181 |
| 1.17.91 Entity.SetAngularVelocity . 181 |
| 1.17.92 Entity.SetAttachType . 182 |
| 1.17.93 Entity.SetCenterOfMassLocal . 183 |
| 1.17.94 Entity.SetCollision . 183 |
| 1.17.95 Entity.SetCollisionLayer. 184 |
| 1.17.96 Entity.SetCullDistance . 185 |
| 1.17.97 Entity.SetDynamicsActive . 185 |
| 1.17.98 Entity.SetFrictionCoeff . 186 |
| 1.17.99 Entity.SetGravity . 186 |
| 1.17.100 Entity.SelLight . 187 |
| 1.17.101 Entity.SetLinearDamping . 187 |
| 1.17.102 Entity.SetLinearVelocity . 188 |
| 1.17.103 Entity.SetLocalMatrix . 189 |
| 1.17.104 Entity.SetMass . 189 |
| 1.17.105 Entity.SetMaxContacts . 190 |
| 1.1 7.106 Entity.SetModel . 191 |
| 1.17.107 Entity.SetPosition . 191 |
| 1.17.108 Entity.SetRestitutionCoeff . 192 |
| 1.17.109 Entity.SetRotationQuat . 193 |
| 1.17.110 Entity.SetRotationX . 193 |
| 1.17.111 Entity.SetRotationXyz . 194 |
| 1.17.112 Entity.SetRotationY . 194 |
| 1.17.113 Entity.SetRotationZ . 195 |
| 1.17.114 Entity.SotScaio . 195 |
| 1.17.115 Entity.SetScreen . 196 |
| 1.17.116 Entity.SetSkeleton . 196 |
| 1.17.117 Entity.SetVisible. 197 |
| 1.17.118 Entity.StopAnim . 198 |
|
|
| Entity |
| Entity. ApplyAngularlmpulse |
| Brief |
| Applies an angular impulse to the entity. |
| Definition |
| Entity.ApplyAngularlmpulse( Entity entity, Vector4 impulse ) |
| Arguments |
| entity - The entity to update.impulse - World space vector specifying angular impulse to be applied to the entity. |
| Return Values |
| None. |
| Description |
| Applies an angular impulse to the entity around the center of mass, creating angular velocity. |
| Examples |
| ! � Apply angular impulse around Y axis |
| ! Entity.ApplyAngularlmpulse( entity, Vector4.Create( 0, 0.1, 0.0) ) |
| See Also |
| None |
| Entity. Applylmpulse |
| Brief |
| Applies an impulse around a point. |
| Definition |
| Entity.Applylmpulse( Entity entity, Vector4 impulse ) |
| Entity.Applylmpulse( Entity entity, Vector4 impulse, Vector4 point ) |
| Arguments |
| entity - The entity to update.impulse - World space vector specifying impulse (or force) to be applied to the entity.point - World space vector |
| specifying the point around which the impulse acts. |
| Return Values |
| None. |
| Description |
| Applies an impulse around a point. If no point is specified, the center of mass of the entity's rigid body is used. |
| Examples |
| ! � Apply an impulse around the entity's center of mass |
| i Entity.Applylmpulse( entity, Vector4.Create( 5, 10, 5 ) ) |
| ! � Apply an impulse around the origin of world space |
| ? Entity.Applylmpulse( entity, Vector4.Create( 0, 10, 0 ), Vector4.Create( 0, 0, 0 ) ) |
| See Also |
| None |
| Entity. AttachPersonLabel |
| Brief |
| Attach a person label to the entity. |
| Definition |
| ! Entity.AttachPersonLabel(Entity entity. Person person, Vector4 offset) |
| Arguments |
| person - The person to take the label from.offset - The offset of the label from the entity's position. (Optional. Defaults to 0, 0, 0). |
| Return Values |
| Description |
| This function will detach the person label from the given person, and attach it to the entity instead. Any number of person labels can be attached |
| to the entity. |
| Examples |
| j Entity.AttachPersonLabel(entity, person, labelOffset) |
| See Also |
| � Entity.DetachPersonLabel |
| Entity. AttachToBone |
| Brief |
| Attach the entity to the specified bone of its parent. |
| Definition |
| Entity.AttachToBone( Entity entity, string boneName ) |
| Arguments |
| entity - The entity to update.boneName - The name of the bone to attach to or nil to clear it. Can be one of the following: |
| "pelvis� |
| "hips" |
| "leftleg" |
| "leftfoot" |
| "rightleg" |
| "rightfoot" |
| "spine" |
| "neck" |
| "head" |
| "leftshoulder� |
| "leftarm" |
| "leftforearm" |
| "lefthand" |
| "rightshoulder" |
| "rightarm" |
| "rightforearm" |
| "righthand" |
| Return Values |
| None. |
| Description |
| Attach the entity to the specified bone of its parent. In addition to specifying the bone to which the entity is to be attached, it is also necessary to |
| specify the person to which the bone belongs. This is done by calling Entity.AttachToParent and supplying the desired person. |
| Examples |
| entity = Entity.Create() |
| Entity.AttachToParent( entity, LocalPlayer.GetPerson() ) |
| Entity.AttachToBone( entity, "head" ) |
| See Also |
| � Entity.Create |
| � Entity.AttachToParent |
| � Entity.SetAttachType |
| Entity. AttachToParent |
| Brief |
| Attaches the entity to the specified parent. |
| Definition |
| Entity.AttachToParent( Entity child. Entity parent, string boneName = nil ) |
| Entity.AttachToParent( Entity child. Person parent, string boneName = nil ) |
| Arguments |
| entity - The entity to update.parent - The parent to attach the entity to or nil to remove it.boneName - The name of the bone to attach to, if any. |
| For a person, it must be from the following list: |
| "pelvis� |
| "hips" |
| "leftleg" |
| "leftfoot" |
| "rightleg" |
| "rightfoot" |
| "spine" |
| "neck" |
| "head" |
| "leftshoulder� |
| "leftarm" |
| "leftforearm" |
| "lefthand" |
| "rightshoulder" |
| "rightarm" |
| "rightforearm" |
| "righthand" |
| Return Values |
| None. |
| Description |
| Attaches the entity to the specified parent. The parent�s world matrix will be applied to the entity so the entity's position, rotation and scale are |
| relative to the parent. If a bone is specified, the entity will be attached to the specified bone in the parent's skeleton. |
| Examples |
| � Parent an entity to an entity |
| entityl = Entity.Create() |
| parent = Entity.Create() |
| Entity.AttachToParent( entityl, parent ); |
| � Parent an entity to a person's right hand |
| entity2 = Entity.Create() |
| person = Person.Findlnlnstance( personld ) |
| Entity.AttachToParent( entity2, person, "righthand" ) |
| See Also |
| � Entity.Create |
| � Person.Findlnlnstance |
| � Entity.SetAttachType |
| Entity. BlendAnimln |
| Brief |
| Blends an animation into, and alongside the currently playing animations. |
| Definition |
| Entity.BlendAnimln( Entity entity, string resourceName, boolean isLooping = true, number time = 0, |
| number easeType = AnimBlendType.Linear, number blendDuration = 0.25, number priority = 0, Animation |
| anim = nil) |
| Entity.BlendAnimln( Entity entity, Resource animResource, boolean isLooping = true, number time = 0, |
| number easeType = AnimBlendType.Linear, number blendDuration = 0.25, number priority = 0, Animation |
| anim = nil) |
| Arguments |
| entity - entity to blend animation ontoresourceName - the name of the animation resource to blend inanimResource - the animation resource to |
| blend inisLooping - flag indicating if the animation played should loop, (default is true)time - point in at which the animation should start playing |
| from (default is 0.0)easeType - the easing method to be used. The values used are in the enumerated type AnimBlendType (default value is |
| AnimBlendType.Linear )blendDuration - the period in seconds, over which the blend factor will increase from 0.0 to 1.0 (default is 0.25)priority - |
| The priority affects where in the animation list an animation will be played. The higher the number, the later it will be played. |
| If a prior animation is being played at the same priority, then the new animation will be placed after the old animation in the list, (default is 0)anim |
| if supplied, the animation handle is set to the newly created active animation |
| Return Values |
| None. |
| Description |
| Values for the ease type are provided by the enumeration AnimBlendType: |
| AnimBlendType.None |
| AnimBlendType. Linear |
| AnimBlendType.SCurve |
| AnimBlendType. Accelerate |
| AnimBlendType. Decelerate |
| Examples |
| Entity.BlendAnimln( entity, "myAnim" ) |
| Entity.BlendAnimln( entity, "myWalk", true, 0.0, AnimBlendType.Linear, 0.25, 0, animHandleToSave) |
| See Also |
| � Entity. GetlndexOfAnim |
| � Entity. GetActiveAnim |
| Entity. BlendAnimOut |
| Brief |
| Blends the specified active animation out. |
| Definition |
| Entity.BlendAnimOut(Entity entity. Animation anim, number easeType = AnimBlendType.Linear, number |
| blendDuration = 0.25) |
| Arguments |
| entity - entity to blend anim out fromanim - animation to blend outeaseType - the blend curve to use when blending out, default is |
| AnimBlendType.LinearblendDuration - the duration over which the animation is blended out, default is 0.25 |
| Return Values |
| None. |
| Description |
| Begins to blend out a currently active animation. To check the progress of the blend, use Animation.GetBlendState and/or |
| Animation.GetBlendTime. An invalid animation handle will have no effect. |
| Examples |
| local animlndex = Entity.GetlndexOfAnim( entity, "idleAnim" ) |
| local hAnim = Entity.GetActiveAnim( entity, animlndex ) |
| Entity.BlendAnimOut( entity, hAnim, AnimBlendType.Linear, 0.25 ) |
| See Also |
| � Entity. BlendAnimln |
| � Entity.GetlndexOfAnim |
| � Entity.GetActiveAnim |
| � Entity. PlayAnim |
| � Animation.GetBlendWeight |
| Entity.Copy |
| Brief |
| Clone an entity's state to another entity. |
| Definition |
| ! Entity.Copy(Entity dest, Entity source) |
| Arguments |
| dest - Destination entity to modify.source - Source entity to copy. |
| Return Values |
| None. |
| Description |
| Copies all state from the source entity to the destination entity, leaving the source entity unchanged. The only state that will not be copied is |
| transform state (position and orientation), as having two identical entities in the same place may cause issues with collision and other systems. |
| The destination entity is still a different entity (it will not compare equal and will have a different unique ID) but will have the same state as the |
| source entity. Similarly to Reset, the hierarchy state of the destination entity will not be modified; if the script wishes to detach the entity and its |
| children this must be done explicitly. |
| Examples |
| ! myDestEntity:Copy(mySourceEntity) |
| See Also |
| � Entity. Reset |
| Entity.Create |
| Brief |
| Creates a new entity. |
| Definition |
| j Entity Entity.Create() |
| Arguments |
| None |
| Return Values |
| A new Entity instance. |
| Description |
| Creates a new entity. |
| Examples |
| ! entity = Entity.Create() |
| See Also |
| None |
| Entity.CreateForceAction |
| Brief |
| Creates a new 'force' action for an entity. |
| Definition |
| number Entity.CreateForceAction( Entity entity, boolean autoEnable = false ) |
| Arguments |
| entity - The entity to which the action will belong.autoEnable - true to automatically enable the action, false otherwise. |
| Return Values |
| A numerical action ID. |
| Description |
| Creates a new 'force' action for an entity. If autoEnable is false, the action can be enabled with Entity.EnableAction. This action applies a force to |
| an entity every physics update. This function is only available if the entity has a collision item. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource") |
| e:EnableDynamics() |
| actionld = Entity.CreateForceAction( e, false ) |
| f = Vector4.Create( 10.0, 0.0, 0.0 ) |
| Entity.EnableAction( e, actionld ) |
| Entity.SetActionForce( e, actionld, f ) |
| See Also |
| � Entity.CreateTorqueAction |
| � Entity. CreatePointForceAction |
| � Entity.EnableAction |
| � Entity.SetActionForce |
| Entity.CreatePointForceAction |
| Brief |
| Creates a new 'point-force' action for an entity. |
| Definition |
| number Entity.CreatePointForceAction( Entity entity, boolean localSpace = true, boolean autoEnable = |
| i false ) |
| Arguments |
| entity - The entity to which the action will belonglocalSpace - true to use a local-space point, false to use a world-space point.autoEnable - true to |
| automatically enable the action, false otherwise. |
| Return Values |
| A numerical action ID. |
| Description |
| Creates a new 'point-force' action for an entity. If autoEnable is false, the action can be enabled with Entity.EnableAction. This action applies a |
| force at a given position to an entity. The position can a local-space point or a world-space point. This function is only available if the entity has a |
| collision item. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource" ) |
| e:EnableDynamics() |
| actionld = Entity.CreatePointForceAction( e, true, false ) |
| f = Vector4.Create( 10.0, 0.0, 0.0 ) |
| p = Vector4.Create( 0.0, 1.0, 0.0 ) |
| Entity.EnableAction( e, actionld ) |
| Entity.SetActionForce( e, actionld, f ) |
| Entity.SetActionPosition( e, actionld, p ) |
| See Also |
| � Entity.CreateTorqueAction |
| � Entity.CreateForceAction |
| � Entity.SetActionPosition |
| Entity.CreateTorqueAction |
| Brief |
| Creates a new 'torque' action for an entity. |
| Definition |
| number Entity.CreateTorqueAction( Entity entity, boolean autoEnable = false ) |
| Arguments |
| entity - The entity to which the action will belong.autoEnable - true to automatically enable the action, false otherwise. |
| Return Values |
| A numerical action ID. |
| Description |
| Creates a new 'torque' action for an entity. If autoEnable is false, the action can be enabled with Entity.EnableAction. This action applies a torque |
| to an entity every physics update. This function is only available if the entity has a collision item. |
| Examples |
| entity = Entity.Create() |
| e : SetCollision ( ,, kCollisionResource ,, ) |
| e:EnableDynamics() |
| actionld = Entity.CreateTorqueAction( e, false ) |
| t = Vector4.Create( 10.0, 0.0, 0.0 ) |
| Entity.EnableAction( e, actionld ) |
| Entity.SetActionTorque( e, actionld, t ) |
| See Also |
| � Entity.CreateForceAction |
| � Entity.CreatePointForceAction |
| � Entity.EnableAction |
| � Entity.SetActionTorque |
| Entity.DebugSetAxesVisible |
| Brief |
| Sets the entity to show its axis or not. |
| Definition |
| Entity.DebugSetAxesVisible( Entity entity, boolean value, boolean recursive, number size = 1) |
| Arguments |
| entity - The entity to update.value - If true the entity shows its axis and if false it hides it.recursive - If true the entity also sets the values of all the |
| children below it.size - The size of the line drawn to represent the axis (in meters). |
| Return Values |
| None. |
| Description |
| Sets the entity to show its axis or not. Entities default to not show their axis when created. Note that this function is provided for debugging |
| purposes and should not be used in a finalized script. |
| Examples |
| entity = Entity.Create() |
| Entity.DebugSetAxesVisible( entity, true, true, 1.0 ) |
| See Also |
| � Entity.DebugSetHierarchyVisible |
| � Entity.DebugSetCollisionVisible |
| Entity.DebugSetCollisionVisible |
| Brief |
| Sets the entity to show its collision or not. |
| Definition |
| ! Entity.DebugSetCollisionVisible( Entity entity, boolean value, boolean recursive ) |
| Arguments |
| entity - The entity to update.value - If true the entity shows its collision shape.recursive - If true the entity also sets the values of all the children |
| below it. |
| Return Values |
| None. |
| Description |
| Sets the entity to show its collision or not. Entities default to not show their collision when created. Note that this function is provided for |
| debugging purposes and should not be used in a finalized script. |
| Examples |
| j entity = Entity.Create() |
| 1 Entity.DebugSetCollisionVisible( entity, true, true ) |
| See Also |
| � Entity.DebugSetAxesVisible |
| � Entity.DebugSetHierarchyVisible |
| Entity.DebugSetHierarchyVisible |
| Brief |
| Sets the entity to show its hierarchy or not. |
| Definition |
| Entity.DebugSetHierarchyVisible( Entity entity, boolean value, boolean recursive ) |
| Arguments |
| entity - The entity to update.value - If true the entity shows its hierarchy with its immediate children and if false it hides it.recursive - If true the |
| entity also sets the values of all the children below it. |
| Return Values |
| None. |
| Description |
| Sets the entity to show its hierarchy or not. Entities default to not show their hierarchy when created. Note that this function is provided for |
| debugging purposes and should not be used in a finalized script. |
| Examples |
| entity = Entity.Create() |
| Entity.DebugSetHierarchyVisible( entity, true, true ) |
| See Also |
| � Entity.DebugSetAxesVisible |
| � Entity.DebugSetCollisionVisible |
| Entity.DestroyAction |
| Brief |
| Destroy an entity action. |
| Definition |
| Entity.DestroyAction( Entity entity, number actionld ) |
| Arguments |
| entity - The entity to which the action belongsactionld - The numerical action ID, obtained at action creation time |
| Return Values |
| None. |
| Description |
| Destroy an entity action. It is good practice to destroy ail actions when no longer required, however the system will also automatically destroy |
| them if the target entity is destroyed. This function is only available if the entity has a collision item. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource") |
| e:EnableDynamics() |
| actionld = Entity.CreatePointForceAction( e, false ) |
| f = Vector4.Create( 10.0, 0.0, 0.0 ) |
| p = Vector4.Create( 0.0, 1.0, 0.0 ) |
| Entity.EnableAction( e, actionld ) |
| Entity.SetActionForce( e, actionld, f ) |
| Entity.SetActionPosition( e, actionld, p ) |
| Entity.DestroyAction( e, actionld ) |
| See Also |
| � Entity.CreateForceAction |
| � Entity.CreateTorqueAction |
| Entity.DetachPersonLabel |
| Brief |
| Detaches a previously attached person label from the entity. |
| Definition |
| Entity.DetachPersonLabel(Entity entity. Person person) |
| Arguments |
| person - The person the label was taken from. |
| Return Values |
| Description |
| This function will detach the person label previously attached to the entity, and will re-attach it to the person it was taken from. |
| Examples |
| 1 Entity.DetachPersonLabel(entity, person) |
| See Also |
| � Entity.AttachPersonLabel |
| Entity.EnableAction |
| Brief |
| Make entity action take effect. |
| Definition |
| 1 Entity.EnableAction( Entity entity, number actionld, boolean enable = true ) |
| Arguments |
| entity - The entity to which the action belongsactionld - The numerical action IDenable - true to enable the action, false otherwise |
| Return Values |
| None. |
| Description |
| Make entity action take effect. A disabled action will not be applied to the entity. This function is only available if the entity has a collision item. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource" ) |
| e:EnableDynamics() |
| actionld = Entity.CreatePointForceAction( e, false ) |
| f = Vector4.Create( 10.0, 0.0, 0.0 ) |
| p = Vector4.Create( 0.0, 1.0, 0.0 ) |
| Entity.EnableAction( e, actionld, true ) |
| Entity.SetActionForce( e, actionld, f ) |
| Entity.SetActionPosition( e, actionld, p ) |
| Entity.DestroyAction( e, actionld ) |
| See Also |
| � Entity. IsActionEnabled |
| Entity.EnableCollision |
| Brief |
| Enables/disables collision on the specified entity. |
| Definition |
| Entity.EnableCollision( Entity entity, boolean enable = true, Phys3dWorld world = nil ) |
| Arguments |
| entity - The entity to update.enable - true to enable collision, false otherwise (defaults to true if not specified).world - The Phys3dWorld to add to |
| the entity to, or nil to add to the default world. |
| Return Values |
| None. |
| Description |
| If collision is enabled for the specified entity, the local player's avatar and other physical entities can collide with it, thereby preventing |
| penetrations. If collision is disabled, the local player's avatar and other physical entities will be able to pass through this entity. Note that the |
| collision world specified in this call will override the collision world specified to SetCollision, if any; specifying nil here will cause the item to be |
| removed from the world specified in SetCollision and added to the default Phys3dWorld. Limitation: Although collision can be enabled for |
| translated and/or rotated entities, scaling is not supported. |
| Examples |
| � Turn off collisions |
| Entity.EnableCollision( entity, false ) |
| � Turn on collisions |
| Entity.EnableCollision( entity ) |
| See Also |
| � Entity.EnableDynamics |
| � Phys3dWorld.Create |
| Entity.EnableCollisionCallbacks |
| Brief |
| Enable or disable collision callbacks for the specified entity. |
| Definition |
| Entity.EnableCollisionCallbacks(Entity entity, boolean enable) |
| Arguments |
| entity - the entity to enable/disable collision callbacks forenable - enable or disable |
| Return Values |
| None. |
| Description |
| Enable or disable collision callbacks for the specified entity. Note that in order to receive callbacks, you must register your interest in the particular |
| type(s) of collision event you want to receive, using Entity.RegisterCollisionCallbackQ. You must also set the maximum contacts using |
| Entity.SetMaxContacts(). Finally, the entity must have collision set and enabled for the callback(s) to occur. The entity need not have dynamics |
| enabled as static entities will also report collisions. |
| Examples |
| � set up a collision data buffer |
| Entity.SetMaxContacts( 64 ) |
| foo = Entity.Create() |
| foo:SetModel("model") |
| foo:SetCollision("collision" ) |
| foo:SetPosition(Vector4.Create(0, 5, 0)) |
| foo:SetVisible(true) |
| foo:EnableCollision(true) |
| foo:EnableDynamics(true) |
| foo:EnableCollisionCallbacks(true) |
| foo:RegisterCollisionCallback(EntityCollision.ContactAdded, ContactAddedCallback, foo) |
| See Also |
| � Entity. RegisterCollisionCallback |
| � Entity.SetMaxContacts |
| � Entity.SetCollision |
| � Entity.EnableCollision |
| Entity.EnableDynamics |
| Brief |
| Enables/disables dynamics on the specified entity. |
| Definition |
| ! Entity.EnableDynamics( Entity entity, boolean enable = true ) |
| Arguments |
| entity - The entity to update.enable - true to enable dynamics, false otherwise (defaults to true if not specified). |
| Return Values |
| None. |
| Description |
| If dynamics is enabled, the rigid body attached to the entity will be activated in PS Home's physics simulation. If dynamics is disabled, the entity |
| will become fixed in its current position and will no longer be affected by the simulation. Note that collision must be enabled on the entity if |
| dynamics is to be enabled. Attempts to set absolute translations or rotations on an entity that has dynamics enabled will be ignored. For this to |
| succeed, dynamics must be temporarily disabled while the transformation is explicitly applied to the entity. Limitation: This function must not be |
| called for entities that have been scaled in any way. |
| Examples |
| � Turn off dynamics |
| Entity.EnableDynamics( entity, false ) |
| � Turn on dynamics (collision must be enabled as well) |
| Entity.EnableCollision ( entity ) |
| Entity.EnableDynamics( entity ) |
| See Also |
| � Entity.EnableCollision |
| Entity.EnableDynamicsAutoDeactivation |
| Brief |
| Enable/disable auto-deactivation of dynamics on the specified entity. |
| Definition |
| Entity.EnableDynamicsAutoDeactivation( Entity entity, boolean enable = true ) |
| Arguments |
| entity - The entity to update.enable - true to enable auto-deactivation, false otherwise (defaults to true if not specified). |
| Return Values |
| None. |
| Description |
| Dynamics must be enabled with Entity.EnableDynamicsf) for the activated/deactivated state to take effect. An Entity with activated dynamics is |
| one that is having it's motion updated. If dynamics are deactivated, Home's physics engine will stop updating the Entity's motion, until it is |
| activated again. Entities can be activated by another call to Entity.SetDynamicsActive or by the application of forces/torques/impulses or by |
| coming into contact with other activated Entities. Entities can be deactivated with Entity.SetDynamicsActive or by allowing auto-deactivation which |
| will deactivate the Entity if it has not been moving for a while. Auto-deactivation can be enabled/disabled with this function. |
| Examples |
| � Disable auto-deactivation |
| Entity.EnableDynamicsAutoDeactivation( entity, false ) |
| � Enable auto-deactivation |
| Entity.EnableCollision( entity ) |
| Entity.EnableDynamics( entity ) |
| Entity.SetDynamicsActive( entity ) |
| Entity.EnableDynamicsAutoDeactivation( entity ) |
| See Also |
| � Entity.EnableDynamics |
| � Entity.SetDynamicsActive |
| � Entity. IsDynamicsAutoDeactivationEnabled |
| Entity.EnablelnterpolatedMode |
| Brief |
| Enable/disable interpolated mode. |
| Definition |
| | Entity.EnablelnterpolatedMode( Entity entity, boolean enable ) |
| Arguments |
| entity - The entity.enable - true to enable interpolated mode, false otherwise. |
| Return Values |
| None |
| Description |
| Enable/disable interpolated mode. Interpolated mode can help smooth the motion of dynamic entities, however there is an extra processing |
| overhead. |
| Examples |
| j Entity.EnablelnterpolatedMode( entity, true ) |
| See Also |
| � Entity. IsinterpolatedModeEnabled |
| Entity.EnableKeepUpright |
| Brief |
| Set whether or not to keep the entity upright. |
| Definition |
| ! Entity.EnableKeepUpright( Entity entity, boolean keepUpright = true, number softness =0.0 ) |
| Arguments |
| entity - entity to be affected.keepUpright - true to keep the entity upright, false otherwisesoftness - the softness of the constraint: 0 is strongest, 1 |
| is weakest. |
| Return Values |
| None. |
| Description |
| Adds a dynamic constraint to try to keep the entity upright. The softness value is only necessary when enabling the keep upright constraint. |
| Examples |
| e = Entity.Create() |
| e:SetCollision("kCollisionResource") |
| e:EnableCollision() |
| e:EnableDynamics() |
| e:EnableKeepUpright( true, 0.1 ) |
| See Also |
| � Entity.IsKeepUprightEnabled |
| Entity. EnableLayerCollision |
| Brief |
| Set whether or not an entity can collide with collision of the specified layer. |
| Definition |
| Entity.EnableLayerCollision( Entity entity, enum layer, boolean enable ) |
| Arguments |
| entity - The entity.layer - The collision layer (a CollisionLayer enum).enable - true to enabled collision, false otherwise. |
| Return Values |
| None. |
| Description |
| Set whether or not an entity can collide with collision of the specified layer. Changes will only take effect for new collisions/overlaps. If two objects |
| are already colliding (or very close), disabling their collisions via this function will not take effect until they separate. Also, if two objects are |
| overlapping but do not currently collide with each other (due to disabled layer collisions), then enabling their collision via this function will not take |
| effect until they separate. |
| Examples |
| Entity.EnableLayerCollision( entityl. Entity.GetCollisionLayer ( entity2 ), false ) |
| See Also |
| � Entity.IsLayerCollisionEnabled |
| Entity. EvaluateAnims |
| Brief |
| Evaluates all current animation(s) active on the entity, and updates the skeleton. |
| Definition |
| Entity.EvaluateAnims( Entity entity ) |
| Arguments |
| entity - The entity to update. |
| Return Values |
| None. |
| Description |
| In the general case, changes made to the animation state on an entity will be reflected in the next frame. In certain situations, a script may wish to |
| modify the animation list and have it immediately reflected in the current frame. In this event, the script can call this function, and PS Home will |
| re-evaluate the entire animation blend list on the entity, and apply the results to the entity's skeleton. Use this function sparingly, as this evaluation |
| is synchronous and significantly slower than the core animation update. Generally the single-frame delay in the normal case can be hidden with |
| appropriate blending, rather than relying on this function. |
| Examples |
| entity = Entity.Create() |
| Entity.SetModel( entity, "mymodel" ) |
| Entity.SetSkeleton( entity, "myskel" ) |
| Entity.PlayAnim( entity, "myanim" ) |
| function OnUpdateO |
| if (playlnstantDeathAnim) then |
| local animlndex = Entity.GetIndexOfAnim( entity, "myanim" ) |
| local anim = Entity.GetActiveAnim( entity, animlndex ) |
| Entity.BlendAnimOut( entity, anim, AnimBlendType.Linear, 0.1 ) |
| Entity.BlendAnimln( entity, "instantDeath", false, 0.0, AnimBlendType.Linear, 0.1, 0) |
| Entity.EvaluateAnims( entity ) |
| end |
| end |
| See Also |
| None |
| Entity.FindMaterials |
| Brief |
| Get an array of materials on an entity's model. |
| Definition |
| Material[] Entity.FindMaterials( Entity entity, string materialld=nil) |
| Arguments |
| entity - The entity to search on.materialld - The material's scriptld as set in max/maya, or nil to get all materials on the entity |
| Return Values |
| An array of Materials that matches the given materialld, or all materials on the entity if no id is given. |
| Description |
| Gets an array of Materials that matches the given materialld, or all materials on the entity if no id is given. |
| Examples |
| entity = Entity.Create() |
| Entity.SetModel( entity, "mymodel" ) |
| allMaterials = Entity.FindMaterials(entity) |
| print( "Found " .. #allMaterials .. " materials." ); |
| for i, v in ipairs(array) do |
| print( tostring( v ) ) |
| end |
| See Also |
| � Material. GetParam |
| � Material.SetAlphaRef |
| � Material.SetBlendMode |
| � Material.SetMatrix |
| � Material.SetTexture |
| � Material.SetVector |
| Entity.GetActiveAnim |
| Brief |
| Returns a handle to a currently active animation |
| Definition |
| Animation Entity.GetActiveAnim( Entity entity, number index ) |
| Entity.GetActiveAnim( Entity entity, number index. Animation anim ) |
| Arguments |
| entity - the entity to accessindex - the index of the animation handle (within the entity's animation list) to retrieve.anim - the animation object to set, |
| instead of returning a new one |
| Return Values |
| If animation is not specified as a parameter, either a handle to the animation, or nil if no current anim. |
| If an animation is specified as a parameter, there is no return value. |
| Description |
| Get a handle to the current active animation. Note that if there is no current active animation and the user has specified an animation object to set, |
| the animation object will be marked as invalid. To check this, use Animation.IsValid. |
| Examples |
| local animlndex = entity:GetlndexOfAnim("myAnim") |
| local anim = entity:GetActiveAnim( animlndex ) |
| See Also |
| � Animation.IsValid |
| � Animation.Create |
| Entity. GetAngularDamping |
| Brief |
| Gets the angular damping of the collision resource attached to the entity. |
| Definition |
| ! number Entity.GetAngularDamping( Entity entity ) |
| Arguments |
| entity - The entity to query. |
| Return Values |
| The angular damping for the entity. |
| Description |
| Gets the angular damping of the collision resource attached to the entity. This function is only valid if the entity has a collision item. |
| Examples |
| ! local damping = Entity.GetAngularDamping( entity ) |
| See Also |
| � Entity.EnableCollision |
| � Entity. EnableDynamics |
| � Entity. SetCollision |
| � Entity. SetAngularDamping |
| Entity.GetAngularVelocity |
| Brief |
| Returns the angular velocity around the center of mass of the entity. |
| Definition |
| ! Vector4 Entity.GetAngularVelocity( Entity entity ) |
| i Entity.GetAngularVelocity( Entity entity, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.outVec - The Vector4 to store the result to. |
| Return Values |
| The entity's current angular velocity. |
| Description |
| Returns the angular velocity around the center of mass of the entity's rigid body in world space. The W component of the returned vector is zero. |
| If outVec is specified it stores the result in there instead of returning a new Vector4. |
| Examples |
| � Add the entity to the physics simulation |
| Entity.EnableCollision ( entity, true ) |
| Entity.EnableDynamics( entity, true ) |
| � Query the angular velocity |
| angularVel = Entity.GetAngularVelocity( entity ) |
| See Also |
| � Entity.GetLinearVelocity |
| Entity.GetBoneCount |
| Brief |
| Get the number of bones in the entity's skeleton. |
| Definition |
| number Entity.GetBoneCount(Entity entity) |
| Arguments |
| entity - Entity to query. |
| Return Values |
| Number of bones in the skeleton, or 0 if the entity has no skeleton attached. |
| Description |
| Retrieves the number of bones/joints in the entity's skeleton. If no skeleton is present, 0 is returned. |
| Examples |
| ! local boneCount = myEntity:GetBoneCount() |
| See Also |
| � Entity.GetBonelndex |
| Entity. GetBonelndex |
| Brief |
| Find the index of a bone in the entity's skeleton. |
| Definition |
| number Entity.GetBonelndex(Entity entity, string boneName) |
| Arguments |
| entity - Entity to query.boneName - Name of bone to locate. |
| Return Values |
| The index of the bone in the skeleton (in range 1 - GetBoneCount()), or 0 if not found. |
| Description |
| Retrieves the index of the specified bone/joint in the entity's skeleton. The index is 1 -based. If the bone cannot be found, or there is no skeleton |
| attached, 0 is returned. |
| Examples |
| ! local leftHandlndex = myEntity:GetBonelndex("lefthand") |
| See Also |
| � Entity.GetBoneCount |
| � Entity.GetBoneLocalMatrix |
| � Entity.GetBoneWorldMatrix |
| Entity.GetBoneLocalMatrix |
| Brief |
| Get the local transform matrix for a bone in the skeleton. |
| Definition |
| ! Entity.GetBoneLocalMatrix(Entity entity, string|number bone, Matrix44 result) |
| Arguments |
| entity - Entity to query.bone - Bone name or index.result (out) - Matrix44 value to store result into. |
| Return Values |
| None. |
| Description |
| Retrieve the local-space transform matrix for a specified bone in the skeleton. If the bone is not found an error will result. Retrieving the matrix by |
| index will be more efficient if done more than once. |
| Examples |
| local mat = Matrix44.Create() |
| myEntity:GetBoneLocalMatrix("lefthand", mat) |
| � or |
| local leftHandlndex = myEntity:GetBonelndex("lefthand") |
| myEntity:GetBoneLocalMatrix(leftHandlndex, mat) |
| See Also |
| � Entity.GetBoneWorldMatrix |
| � Entity.GetBonelndex |
| Entity.GetBoneWorldMatrix |
| Brief |
| Get the world transform matrix for a bone in the skeleton. |
| Definition |
| Entity.GetBoneWorldMatrix(Entity entity, string|number bone, Matrix44 result) |
| Arguments |
| entity - Entity to query.bone - Bone name or index.result (out) - Matrix44 value to store result into. |
| Return Values |
| None. |
| Description |
| Retrieve the world-space transform matrix for a specified bone in the skeleton. If the bone is not found an error will result. Retrieving the matrix by |
| index will be more efficient if done more than once. |
| Examples |
| local mat = Matrix44.Create() |
| myEntity:GetBoneWorldMatrix("lefthand", mat) |
| � or |
| local leftHandlndex = myEntity:GetBonelndex("lefthand") |
| myEntity:GetBoneWorldMatrix(leftHandlndex, mat) |
| See Also |
| � Entity.GetBoneLocalMatrix |
| � Entity.GetBonelndex |
| Entity.GetCenterOfMassLocal |
| Brief |
| Returns the position of the entity's center of mass in local space. |
| Definition |
| Vector4 Entity.GetCenterOfMassLocal( Entity entity ) |
| Entity.GetCenterOfMassLocal( Entity entity, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.outVec - The Vector4 to store the result to. |
| Return Values |
| The position of the entity's center of mass in local space. |
| Description |
| Returns the position of the entity's center of mass in local space. This may be offset from the coordinate origin of the entity depending on its |
| physics configuration. If outVec is specified it is used to store the result instead of returning a new Vector4. This function is only available if the |
| entity has a collision item. |
| Examples |
| print( "Entity COM = " .. Entity.GetCenterOfMassLocal( entity ) ) |
| See Also |
| � Entity. EnableDynamics |
| � Entity.GetCenterOfMassLocal |
| Entity.GetCenterOfMassWorld |
| Brief |
| Returns the position of the entity's center of mass in world space. |
| Definition |
| Vector4 Entity.GetCenterOfMassWorld( Entity entity ) |
| Entity.GetCenterOfMassWorld( Entity entity, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.outVec - The Vector4 to store the result to. |
| Return Values |
| The position of the entity's center of mass in world space. |
| Description |
| Returns the position of the entity's center of mass in world space. This may differ from the position of the entity depending on its physics |
| configuration. If outVec is specified it stores the result in there instead of returning a new Vector4. |
| Examples |
| ! print( "Entity COM = " .. Entity.GetCenterOfMassWorld( entity ) ) |
| See Also |
| � Entity.EnableDynamics |
| Entity.GetChildren |
| Brief |
| Get an array of the child entities of a specified entity. |
| Definition |
| table Entity.GetChildren(Entity entity) |
| Arguments |
| entity - entity to obtain children from. |
| Return Values |
| An array of the child entities of the specified entity. |
| Description |
| If an entity has had children attached using Entity.AttachToParent, this function will return an array of all the child entities, in the order in which |
| they were attached. If there are no children, an empty table will be returned. |
| Examples |
| parent = Entity.Create() |
| childl = Entity.Create() |
| child2 = Entity.Create() |
| childl:AttachToParent(parent) |
| child2:AttachToParent(parent) |
| children = parent:GetChildren() |
| print(#children) � prints 2 , children[1] == childl and children[2] == child2 |
| print(#childl:GetChildren()) � prints 0, childl has no children |
| See Also |
| � Entity.AttachToParent |
| � Entity.GetParent |
| � Entity.GetSiblings |
| Entity.GetCloth |
| Brief |
| Retrieve a handle to the entity's cloth meshes, if any. |
| Definition |
| Cloth Entity.GetCloth(Entity entity) |
| Arguments |
| entity - Entity to query. |
| Return Values |
| A Cloth object, or nil if the entity has no model or model contains no cloth elements. |
| Description |
| If the entity's model contains cloth elements, this function can be used to obtain a handle to the cloth elements to alter their parameters. All cloth |
| elements in the model are modified when using the cloth handle. |
| Examples |
| myEntity:SetModel("ModelWithCloth") |
| local cloth = myEntity:GetCloth() |
| if (cloth) then |
| cloth:SetWindAngle(135) |
| end |
| See Also |
| � Cloth.SetWindAngle |
| Entity.GetCollisionLayer |
| Brief |
| Query the collision layer of an entity. |
| Definition |
| ! enum Entity.GetCollisionLayer( Entity entity ) |
| Arguments |
| entity - The entity. |
| Return Values |
| The collision layer (a CollisionLayer enum). |
| Description |
| Query the collision layer of an entity. |
| Examples |
| i print( "collisionLayer="..Entity.GetCollisionLayer( entity ) |
| See Also |
| � Entity.SetCollisionLayer |
| Entity.GetContactCount |
| Brief |
| Retrieve the number of contacts passed to a collision callback. |
| Definition |
| ! number Entity.GetContactCount() |
| Arguments |
| None |
| Return Values |
| Number of contacts passed to collision callback. |
| Description |
| Retrieve the number of contacts available in a collision callback. This function is only valid inside a collision callback. |
| Examples |
| function ContactAddedCallback(entity) |
| local numContacts = Entity.GetContactCount() |
| print(numContacts .. ' contacts added') |
| end |
| See Also |
| � Entity.GetContactPoint |
| � Entity.GetContactEntity |
| � Entity.GetContactRelVelocity |
| � Entity.GetContactld |
| Entity.GetContactEntity |
| Brief |
| Retrieve the other entity that has been contacted in a collision. |
| Definition |
| ! Entity Entity.GetContactEntity(number index) |
| Arguments |
| index - index of the contact point |
| Return Values |
| The contacted entity, or nil in a collision with the world. |
| Description |
| Retrieve the other entity contacted in a collision, that is, the entity that is not reporting the collision. In a collision with world geometry or another |
| physics object not owned by an Entity, nil is returned. It is important to realise that the entity returned is not the exact same entity instance from |
| Lua's perspective. It will compare equal using == or ~=, and all API functions are available, but if used as a table key it will not match the "original'' |
| entity. If you wish to match the entities using a table, it is recommended to insert them using a unique key based on the entity itself. Note that this |
| function is only valid from within a collision callback, and will not be available for ContactRemoved callbacks. |
| Examples |
| function ContactAddedCallback(entity) |
| local numContacts = Entity.GetContactCount () |
| for i = 1, numContacts do |
| local entity = Entity.GetContactEntity(i) |
| if (entity == nil) then |
| print("I've hit the world!\n") |
| end |
| end |
| end |
| See Also |
| � Entity.GetContactCount |
| � Entity.GetContactPoint |
| � Entity.GetContactRelVelocity |
| Entity. GetContactld |
| Entity.GetContactld |
| Brief |
| Retrieve the unique contact ID. |
| Definition |
| number Entity.GetContactld(number index) |
| Arguments |
| index - index of the contact point |
| Return Values |
| The contact ID. |
| Description |
| Retrieve the unique ID number assigned the contact. This number will be preserved across multiple frames and so can be used to track individual |
| contacts over the duration of the collision. Do not make any assumptions about the ID numbers returned. Note that this function is only valid from |
| within a collision callback. |
| Examples |
| function ContactProcessCallback(entity) |
| local numContacts = Entity.GetContactCount () |
| for i = 1, numContacts do |
| local id = Entity.GetContactld(i) |
| UpdateContactTracker(id) � do something with contacts being tracked |
| end |
| end |
| See Also |
| Entity.GetContactPoint |
| Brief |
| Retrieve the position and/or normal of the specified contact. |
| Definition |
| Entity.GetContactPoint(number index, Vector4 position = nil, Vector4 normal = nil) |
| Arguments |
| index - index of the contact pointposition - Vector4 to store the position into, or nil if unwantednormal - Vector4 to store the normal into, or nil if |
| unwanted |
| Return Values |
| None. |
| Description |
| Retrieve the position and/or normal of a contact, specified by an index which must be between 1 and the contact count. Passing nil to position |
| and/or normal will skip retrieval of that value. Both values will be given in world space. Note that this function is only valid from within a collision |
| callback, and will not be available for ContactRemoved callbacks. |
| Examples |
| function ContactAddedCallback(entity) |
| local numContacts = Entity.GetContactCount () |
| local pos = Vector4.Create () |
| local norm = Vector4.Create() |
| for i = l r numContacts do |
| Entity.GetContactPoint(i, pos, norm) |
| SpawnlmpactEffeet(pos, norm) � user function to spawn an impact particle effect |
| end |
| end |
| See Also |
| � Entity.GetContactCount |
| � Entity.GetContactEntity |
| � Entity.GetContactRelVelocity |
| � Entity.GetContactld |
| Entity.GetContactRelVelocity |
| Brief |
| Retrieve the relative velocity of the colliding objects. |
| Definition |
| number Entity.GetContactRelVelocity(number index) |
| Arguments |
| index - index of the contact point |
| Return Values |
| The relative velocity, projected onto the contact normal. |
| Description |
| Retrieve the relative velocity of the colliding objects, projected onto the contact normal. Note that the value may be negative or positive. Note also |
| that this function is only valid from within a collision callback, and only in reponse to the ContactAdded event. |
| Examples |
| function ContactAddedCallback(entity) |
| local numContacts = Entity.GetContactCount() |
| local pos = Vector4.Create() |
| local norm = Vector4.Create() |
| for i = 1, numContacts do |
| local relVel = math.abs(Entity.GetContactRelVelocity(i)) |
| Entity.GetContactPoint(i, pos, norm) |
| if (relVel > 10) then |
| SpawnBigParticle(pos, norm) |
| else |
| SpawnSmallParticle(pos, norm) |
| end |
| end |
| end |
| See Also |
| Entity.GetContactUserld |
| Brief |
| Retrieve the user ID of the part of a party (entity or collision geometry) involved in a contact. |
| Definition |
| number, number Entity.GetContactUserld(number contactIndex) |
| number Entity.GetContactUserld(number contactlndex, number partylndex) |
| Arguments |
| contactlndex - index of the contact pointpartylndex - index of the party; 1 or 2 |
| Return Values |
| In the first usage, both user IDs in order, or the single user ID requested in the second usage. If a value is |
| nil, no user ID is available. |
| Description |
| Retrieve the user ID(s) of the part of a party (entity or collision geometry) involved in a contact. Note that this function is only valid from within a |
| collision callback. Note that there are two collision items involved in a contact, so there are two corresponding user IDs. The user IDs are ordered |
| such that party 1 is the entity registered for collision callbacks, and party 2 is the other collision item. |
| Examples |
| function ContactProcessCallback(entity) |
| local numContacts = Entity.GetContactCount() |
| for i = 1, numContacts do |
| local idA = Entity.GetContactUserld(i, 1) |
| local idB = Entity.GetContactUserld(i, 2) |
| � or local idA, idB = Entity.GetContactUserld(i) |
| if idA == 100 then |
| print("UserlD 100 has been hit!") |
| end |
| end |
| end |
| See Also |
| Entity.GetCullDistance |
| Brief |
| Get the cull distance for an entity. |
| Definition |
| ! number Entity.GetCullDistance(Entity entity) |
| Arguments |
| entity - The entity to modify. |
| Return Values |
| The cull distance of the entity, or 0 if disabled. |
| Description |
| Get the cull distance of an entity set with SetCullDistance. |
| Examples |
| ! if (myEntity:GetCullDistance() > 500) then |
| print("This entity has a very large cull distance!") |
| | end |
| See Also |
| � Entity.SetCullDistance |
| Entity.GetGravity |
| Brief |
| Query the gravity vector of the entity. |
| Definition |
| Vector4 Entity.GetGravity( Entity entity ) |
| Entity.GetGravity( Entity entity, Vector4 gravityVectorOut ) |
| Arguments |
| entity - entity to be queried.gravityVectorOut - gravity vector storage. |
| Return Values |
| The gravity vector |
| Description |
| Query the gravity vector of the entity. This function is only valid if the entity has a collision item. |
| Examples |
| � first form |
| print( Entity.GetGravity( entity ) ) |
| � second form |
| local grav = Vector4.Create() |
| Entity.GetGravity( entity, grav ) |
| print( grav ) |
| See Also |
| � Entity.SetGravity |
| Entity. GetlndexOfAnim |
| Brief |
| Find the index of the active animation that is using the specified animation resource. |
| Definition |
| number Entity.GetIndexOfAnim( Entity entity, string resourceName, number startlndex = 1 ) |
| Arguments |
| entity - the entity to queryresourceName - the name of the animation we are looking forstartlndex - index to begin search at |
| Return Values |
| The index of the animation being queried, or nil if not found. |
| Description |
| The start index is provided so that multiple searches can be made if the same resorce is being played multiple times. |
| Examples |
| ; local animlndex = Entity.GetlndexOfAnim( myEntity, "myAnim" ) |
| See Also |
| � Entity. GetActiveAnim |
| � Entity. BlendAnimln |
| � Entity. BlendAnimOut |
| � Entity. StopAnim |
| Entity. GetLinearDamping |
| Brief |
| Gets the linear damping of the collision resource attached to the entity. |
| Definition |
| number Entity.GetLinearDamping( Entity entity ) |
| Arguments |
| entity - The entity to query. |
| Return Values |
| The linear damping for the entity. |
| Description |
| Gets the linear damping of the collision resource attached to the entity. This function is only valid if the entity has a collision item. |
| Examples |
| I local damping = Entity.GetLinearDamping( entity ) |
| See Also |
| � Entity.EnableCollision |
| � Entity. EnableDynamics |
| � Entity.SetCollision |
| � Entity. SetLinearDamping |
| Entity.GetLinearVelocity |
| Brief |
| Returns the linear velocity of the entity. |
| Definition |
| ! Vector4 Entity.GetLinearVelocity( Entity entity ) |
| ! Entity.GetLinearVelocity( Entity entity, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.outVec - The vector to write the result to. |
| Return Values |
| The entity's current linear velocity. |
| Description |
| Returns the linear velocity of the center of mass of the entity's rigid body in world space. The W component of the returned vector is zero. If |
| outVec is specified it stores the result in there instead of returning a new Vector4. |
| Examples |
| � Add the entity to the physics simulation |
| Entity.EnableCollision ( entity, true ) |
| Entity.EnableDynamics( entity, true ) |
| � Query the linear velocity |
| linearVel = Entity.GetLinearVelocity( entity ) |
| See Also |
| � Entity. GetAngularVelocity |
| Entity. GetLocalBounds |
| Brief |
| Retrieve the local-space bounds of an entity's model. |
| Definition |
| Entity.GetLocalBounds(Entity entity, Vector4 min, Vector4 max) |
| Arguments |
| entity - The entity to query.min (out) - Vector4 to receive the minimum extents.max (out) - Vector4 to receive the maximum extents. |
| Return Values |
| None. |
| Description |
| This function will retrieve the local-space bounds of the entity's model. If no model is set then an error will be raised. The returned vectors indicate |
| the minimum and maximum extents on each axis in local space, and define an axis-aligned bounding box. The W components will be 1. |
| Examples |
| Vector4 min = Vector4.Create() |
| Vector4 max = Vector4.Create() |
| myEntity:GetLocalBounds(min, max) |
| local center = (min + max) * 0.5 |
| local extents = max - center |
| See Also |
| � Entity.GetWorldBounds |
| Entity.GetLocalMatrix |
| Brief |
| Returns the current local transformation matrix of the entity. |
| Definition |
| Matrix44 Entity.GetLocalMatrix( Entity entity ) |
| Entity.GetLocalMatrix( Entity entity, Matrix44 outMat ) |
| Arguments |
| entity - The entity to query.outMat - The Matrix44 to store the result to. |
| Return Values |
| The current local matrix of the entity. |
| Description |
| Returns the current local transformation matrix of the entity. This matrix is relative to the coordinate system of the entity's parent, if one exists. If |
| the entity has no parent, the matrix is relative to the world space coordinate system. If outMat is specified it stores the result in there instead of |
| returning a new Matrix44. |
| Examples |
| entity = Entity.Create() |
| mat = Entity.GetLocalMatrix( entity ) |
| print( mat ) |
| See Also |
| � Entity.Create |
| Entity.GetMass |
| Brief |
| Returns the mass of the collision resource attached to the entity. |
| Definition |
| number Entity.GetMass( Entity entity ) |
| Arguments |
| entity - The entity to query. |
| Return Values |
| The mass of the collision resource attached to the entity. |
| Description |
| Gets the mass of the rigid body that is attached to the entity. This function can only be called if the entity has a collision resource. |
| Examples |
| ! local mass = Entity.GetMass( entity ) |
| See Also |
| � Entity.EnableCollision |
| � Entity. EnableDynamics |
| � Entity.SetColiision |
| � Entity.SetMass |
| Entity.GetNumActiveAnims |
| Brief |
| Returns the number of active animations currently being played on the specified entity. |
| Definition |
| ! number Entity.GetNumActiveAnims( Entity entity ) |
| Arguments |
| entity - the entity to query |
| Return Values |
| The number of active anims running. |
| Description |
| Returns the number of active animations currently being played on the specified entity. |
| Examples |
| ! local numAnims = Entity.GetNumActiveAnims( myEntity ) |
| See Also |
| None |
| Entity.GetParent |
| Brief |
| Get the parent entity for the specified entity, if any. |
| Definition |
| Entity Entity.GetParent(Entity entity) |
| Arguments |
| entity - entity to obtain parent from. |
| Return Values |
| The parent entity, or nil if no parent. |
| Description |
| If an entity has been attached to another entity using Entity.AttachToParent, the parent entity can be retrieved with this function. |
| Examples |
| ! parent = Entity.Create() |
| i entity = Entity.Create() |
| | entity:AttachToParent(parent) |
| if (entity:GetParent () == parent) then |
| print("Attached!") � prints Attached! |
| | end |
| L_I |
| See Also |
| Entity.AttachToParent |
| � Entity.GetChildren |
| � Entity.GetSiblings |
| Entity.GetPointVelocity |
| Brief |
| Returns the velocity of a point on a physics collision item. |
| Definition |
| Vector4 Entity.GetPointVelocity( Entity entity, Vector4 point ) |
| Entity.GetPointVelocity( Entity entity, Vector4 point, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.point - The point of which you wish to know the velocity.outVec - The Vector4 to store the result to. |
| Return Values |
| The velocity of the point on the rigid body. |
| Description |
| Returns the velocity of a point on a physics collision item in world space. If outVec is specified it stores the result it is used to store the result |
| instead of returning a new Vector4. This function is only available if the entity has a collision item. |
| Examples |
| j print( "Point velocity lm up = " .. Entity.GetPointVelocity( entity, Vector4.Create( 0, 1, 0 ) ) |
| See Also |
| � Entity. EnableDynamics |
| Entity.GetPosition |
| Brief |
| Returns the entity's position. |
| Definition |
| Vector4 Entity.GetPosition( Entity entity ) |
| Entity.GetPosition( Entity entity, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.outVec - The Vector4 to store the result to. |
| Return Values |
| The entity's position. |
| Description |
| Returns the entity's position. If the entity has a parent, the returned position is relative to the parent's coordinate system. If outVec is specified it |
| stores the result in there instead of returning a new Vector4. |
| Examples |
| print( "Entity position = " .. Entity.GetPosition( entity ) ) |
| See Also |
| None |
| Entity.GetRotationQuat |
| Brief |
| Gets the rotation as a quaternion. |
| Definition |
| Quaternion Entity.GetRotationQuat( Entity entity ) |
| Entity.GetRotationQuat( Entity entity, Quaternion outQuat ) |
| Arguments |
| entity - The entity to query.outQuat - The Quaternion to store the result to. |
| Return Values |
| The rotation of the entity in quaternion form, or none using the second syntax. |
| Description |
| Gets the rotation of the entity in quaternion form. If outQuat is specified it is used for storing the result instead of returning a new Quaternion. |
| Examples |
| j entity = Entity.Create() |
| i rotation = entity:GetRotationQuat() |
| See Also |
| � Entity.SetRotationQuat |
| Entity.GetRotationXyz |
| Brief |
| Gets the rotation about the x, y, and z-axis in degrees. |
| Definition |
| Vector4 Entity.GetRotationXyz( Entity entity ) |
| Entity.GetRotationXyz( Entity entity, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.outVec - The Vector4 to store the result to. |
| Return Values |
| The XYZ-ordered axis rotation of the entity. |
| Description |
| Gets the rotation about the x, y, and z-axis of the entity's local coordinate system in degrees. The rotation order is x, y, z. The W component of the |
| returned vector is set to 0.0. If outVec is specified it stores the result in there instead of returning a new Vector4. |
| Examples |
| j entity = Entity.Create() |
| i rotation = Entity.GetRotationXyz( entity ) |
| See Also |
| � Entity.SetRotationXyz |
| Entity.GetScale |
| Brief |
| Returns the entity's scale. |
| Definition |
| Vector4 Entity.GetScale( Entity entity ) |
| Entity.GetScale( Entity entity, Vector4 outVec ) |
| Arguments |
| entity - The entity to query.outVec - The Vector4 to store the result to. |
| Return Values |
| The entity's scale. |
| Description |
| Returns the entity's scale. If the entity has a parent, the returned scale is relative to the parent's coordinate system. If outVec is specified it stores |
| the result in there instead of returning a new Vector4. |
| Examples |
| ! print( "Entity scale = " .. Entity.GetScale( entity ) ) |
| See Also |
| � Entity.AttachToParent |
| � Entity.SetScale |
| Entity.GetSiblings |
| Brief |
| Get an array of the sibling entities of a specified entity. |
| Definition |
| table Entity.GetSiblings(Entity entity) |
| Arguments |
| entity - entity to obtain siblings from. |
| Return Values |
| An array of the sibling entities of the specified entity. |
| Description |
| If an entity has been attached to a parent entity using Entity.AttachToParent, this function will return an array of all other entities attached to the |
| same parent, excluding this entity. If this entity is the only child, the table will be empty. |
| Examples |
| parent = Entity.Create() |
| childl = Entity.Create() |
| child2 = Entity.Create() |
| childl:AttachToParent(parent) |
| child2:AttachToParent(parent) |
| childlSiblings = childl:GetSiblings() |
| child2Siblings = child2:GetSiblings() |
| if (childlSublings[1] ~= child2 or child2Siblings[1] ~= childl) then |
| error("This will never happen") |
| end |
| See Also |
| � Entity.AttachToParent |
| � Entity.GetParent |
| � Entity.GetChildren |
| Entity.GetUniqueld |
| Brief |
| Returns a unique integer ID that identifies the entity. |
| Definition |
| number Entity.GetUniqueld(Entity entity) |
| Arguments |
| entity - The entity to query. |
| Return Values |
| A unique integer ID value. |
| Description |
| The integer ID returned is guaranteed to be unique for all currently active entities on the local client, and it is guaranteed that if entityl == entity2 |
| is true, then entityl :GetUniqueld() == entity2:GetUniqueld() is also true, and vice versa. No assumptions should be made about the nature of the |
| ID value, and it is not guaranteed to be persistent or reproducible across instances or PS Home versions. Note that the ID value isn't replicated in |
| any way, it only applies to local entities. |
| Examples |
| local hitEntity = raycast:GetHitEntity() |
| if (myEntityTable[ hitEntity:GetUniqueld() ] == nil) then |
| print("New entity hit!") |
| myEntityTable[ hitEntity:GetUniqueld() ] = hitEntity |
| end |
| See Also |
| None |
| Entity.GetWorldBounds |
| Brief |
| Retrieve the world-space bounds of an entity's model. |
| Definition |
| Entity.GetWorldBounds(Entity entity, Vector4 min, Vector4 max) |
| Arguments |
| entity - The entity to query.min (out) - Vector4 to receive the minimum extents.max (out) - Vector4 to receive the maximum extents. |
| Return Values |
| None. |
| Description |
| This function will retrieve the world-space bounds of the entity's model. If no model is set then an error will be raised. The returned vectors |
| indicate the minimum and maximum extents on each axis in world space, and define a world-space axis-aligned bounding box. The W |
| components will be 1. NOTE: the world bounds are only updated when the model renders. Thus if you move the object in current frame, the world |
| bounds will be out of date until the following frame. If you wish to compute up to date world bounds in this specific case, transform the local |
| bounds and take the AABB of the OBB thus formed. |
| Examples |
| Vector4 min = Vector4.Create() |
| Vector4 max = Vector4.Create() |
| myEntity:GetWorldBounds(min, max) |
| local center = (min + max) * 0.5 |
| local extents = max - center |
| See Also |
| � Entity.GetLocalBounds |
| Entity. GetWorldMatrix |
| Brief |
| Returns the current world matrix of the entity. |
| Definition |
| Matrix44 Entity.GetWorldMatrix( Entity entity ) |
| Entity.GetWorldMatrix( Entity entity, Matrix44 outMat ) |
| Arguments |
| entity - The entity to query.outMat - The Matrix44 to store the result to. |
| Return Values |
| The current world matrix of the entity. |
| Description |
| Returns the current world matrix of the entity. If outMat is specified it stores the result in there instead of returning a new Matrix44. |
| Examples |
| j entity = Entity.Create() |
| ; mat = Entity.GetWorldMatrix( entity ) |
| j print( mat ) |
| See Also |
| � Entity.Create |
| Entity.HasActiveAnims |
| Brief |
| Indicates if there are any active animations on the entity. |
| Definition |
| boolean Entity.HasActiveAnims( Entity entity ) |
| Arguments |
| entity - the entity to query |
| Return Values |
| True if there are any active animations being played on the entity, or false if not. |
| Description |
| This function is more efficient than checking if Entity.GetNumActiveAnims() is 0. |
| Examples |
| ! if ( Entity.HasActiveAnims( myEntity ) ) then |
| Entity.StopAnim( myEntity ) |
| | end |
| See Also |
| Entity. BlendAnimln |
| � Entity. BlendAnimOut |
| � Entity.GetlndexOfAnim |
| � Entity.GetActiveAnim |
| Entity. IsActionEnabled |
| Brief |
| Query whether entity action is enabled. |
| Definition |
| ! boolean Entity.IsActionEnabled( Entity entity, number actionld ) |
| Arguments |
| entity - The entity to which the action belongsactionld - The numerical action ID |
| Return Values |
| true if enabled, false otherwise |
| Description |
| Query whether an entity action is currently enabled. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource" ) |
| e:EnableDynamics() |
| actionld = Entity.CreatePointForceAction( e, false ) |
| f = Vector4.Create( 10.0, 0.0, 0.0 ) |
| p = Vector4.Create( 0.0, 1.0, 0.0 ) |
| Entity.EnableAction( e, actionld, true ) |
| print( Entity.IsActionEnabled( e, actionld ) ) |
| Entity.SetActionForce( e, actionld, f ) |
| Entity.SetActionPosition( e, actionld, p ) |
| Entity.DestroyAction( e, actionld ) |
| See Also |
| � Entity.EnableAction |
| Entity.lsDynamicsActive |
| Brief |
| Query whether dynamics is active on the specified entity. |
| Definition |
| boolean Entity.IsDynamicsActive( Entity entity ) |
| Arguments |
| entity - The entity to update. |
| Return Values |
| true if dynamics is active, false otherwise. |
| Description |
| Query whether dynamics is active on the specified entity. See Entity.SetDynamicsActive documentation for more information. This function is only |
| valid if the entity has a collision item. |
| Examples |
| � Activate dynamics (collision must be enabled as well) |
| Entity.EnableCollision( entity ) |
| Entity.EnableDynamics( entity ) |
| Entity.SetDynamicsActive( entity ) |
| print( Entity.IsDynamicsActive( entity ) ) |
| See Also |
| � Entity.EnableDynamics |
| � Entity.SetDynamicsActive |
| Entity.lsDynamicsAutoDeactivationEnabled |
| Brief |
| Query whether auto-deactivation of dynamics is enabled on the specified entity. |
| Definition |
| boolean Entity.IsDynamicsAutoDeactivationEnabled( Entity entity ) |
| Arguments |
| entity - The entity to update. |
| Return Values |
| true if enabled, false otherwise. |
| Description |
| Query whether auto-deactivation of dynamics is enabled on the specified entity. See Entity.EnableDynamicsAutoDeactivation for more |
| information. |
| Examples |
| � Enable auto-deactivation |
| Entity.EnableCollision ( entity ) |
| Entity.EnableDynamics( entity ) |
| Entity.SetDynamicsActive( entity ) |
| Entity.EnableDynamicsAutoDeactivation( entity ) |
| print( ( Entity.IsDynamicsAutoDeactivationEnabled( entity ) ) ) |
| See Also |
| Entity. EnableDynamics |
| � Entity.SetDynamicsActive |
| � Entity. EnableDynamicsAutoDeactivation |
| Entity.IsInterpolatedModeEnabled |
| Brief |
| Query whether or not interpolated mode is enabled. |
| Definition |
| ! boolean Entity.IsInterpolatedModeEnabled( Entity entity ) |
| Arguments |
| entity - The entity. |
| Return Values |
| true if interpolated mode is enabled, false otherwise. |
| Description |
| Query whether or not interpolated mode is enabled. Interpolated mode can help smooth the motion of dynamic entities, particularly those that are |
| directly controlled by the user; however, there is an extra processing overhead. |
| Examples |
| ! print( Entity.IsInterpolatedModeEnabled( entity ) ) |
| See Also |
| � Entity.EnablelnterpolatedMode |
| Entity. IsKeepUprightEnabled |
| Brief |
| Query whether or not the entity is being kept upright. |
| Definition |
| ! boolean Entity.IsKeepUprightEnabled( Entity entity ) |
| Arguments |
| entity - entity to be queried. |
| Return Values |
| true if the entity is being kept upright, false otherwise. |
| Description |
| Query whether or not the entity is being kept upright, e = Entity.Create() e:SetCollision("kCollisionResource") e:EnableCollision() |
| e:EnableDynamics() e:EnableKeepUpright( true, 0.1 ) print( e:lsKeepUprightEnabled()) |
| Examples |
| ! Entity.EnableKeepUpright |
| See Also |
| None |
| Entity.IsLayerCollisionEnabled |
| Brief |
| Query whether or not an entity can collide with collision of the specified layer. |
| Definition |
| ! boolean Entity.IsLayerCollisionEnabled( Entity entity, enum layer ) |
| Arguments |
| entity - The entity.layer - The collision layer (a CollisionLayer enum). |
| Return Values |
| true if collision is enabled, false otherwise. |
| Description |
| Query whether or not an entity can collide with collision of the specified layer. |
| Examples |
| : print( Entity.IsLayerCollisionEnabled( entityl, Entity.GetCollisionLayer( entity2 ) ) ) |
| See Also |
| � Entity.EnableLayerCollision |
| Entity.IsVisible |
| Brief |
| Indicates if the entity is currently marked as visible. |
| Definition |
| ! Entity.IsVisible(Entity entity) |
| Arguments |
| entity - the entity to query. |
| Return Values |
| true if the object is marked as visible, false otherwise. |
| Description |
| An entity can be marked as invisible for several reasons: the script can do so using SetVisible, entities attached to a person that is invisible or too |
| close to the camera, and entities that represent scene objects hidden by the client (for example, active furniture during removal). This function will |
| indicate whether an entity has been marked invisible for any reason. It is not possible to tell from the return value why the entity is invisible, but it |
| may be helpful to a script if it is desired to hide other entities/effects when one entity is invisible. It is not required to check this for all entities, as |
| only entities attached to scene objects as indicated above can be affected outside the script's control. Visibility is also inherited, so children of an |
| invisible entity are automatically made invisible also, and this functionality should be leveraged if it is desired to hide groups of entities when a |
| parent entity is made invisible for any reason. |
| Examples |
| if (not Active.GetEntity():IsVisible()) then |
| � active has been hidden, pause our special unattached particle effects |
| PauseParticles() |
| end |
| See Also |
| � Active.GetEntity |
| � Entity.SetVisible |
| Entity. LookAt |
| Brief |
| Rotate an entity to look at a specified point. |
| Definition |
| Entity.LookAt( Entity entity, Vector4 targetPoint, Vector up=[0,l,0,0] ) |
| Arguments |
| entity - The entity to update.targetPoint - The point to look at, in the entity's parent space.up - The up vector of the entity, in the entity's parent |
| space. |
| Return Values |
| None. |
| Description |
| Rotate the entity to look at the specified point. The entity looks down its forward/front vector, the z-axis. Note that this is a one-off reorientation of |
| the entity, it will not track the look-at point if the entity (or its parent) moves. |
| Examples |
| ! entity = Entity.Create() |
| Entity.LookAt( entity, Vector4.Create( 0.5, 0.5, 0 ) ) |
| See Also |
| � Entity.Create |
| � Vector4. Create |
| Entity. LookAtWorld |
| Entity.LookAtWorld |
| Brief |
| Rotate an entity to look at a specified point in world space. |
| Definition |
| ! Entity.LookAtWorld( Entity entity, Vector4 targetPoint, Vector up=[0,l,0,0] ) |
| Arguments |
| entity - The entity to update.targetPoint - The point to look at in world space.up - The up vector of the entity in world space. |
| Return Values |
| None. |
| Description |
| Rotate the entity to look at the specified point in world space. The entity looks down its forward/front vector, the z-axis. Note that this is a one-off |
| reorientation of the entity, it will not track the look-at point if the entity (or its parent) moves. |
| Examples |
| 1 entity = Entity.Create() |
| j Entity.LookAtWorld( entity, Vector4.Create( 0.5, 0.5, 0 ) ) |
| See Also |
| � Entity.Create |
| � Vector4.Create |
| � Entity.LookAt |
| Entity.ParticlelsAlive |
| Brief |
| Returns true if particle effect is still alive. |
| Definition |
| ! boolean Entity.ParticlelsAlive( Entity entity ) |
| Arguments |
| entity - The entity to query. |
| Return Values |
| true if any particles are still active, false otherwise. |
| Description |
| Returns true if particle effect is still alive. |
| Examples |
| entity = Entity.Create() |
| Entity.ParticleSetEffeet( entity, "myparticle" ) |
| if Entity.ParticlelsAlive( entity ) then |
| print( "Particle system still active!" ) |
| end |
| See Also |
| � Entity.Create |
| � Entity. ParticleSetEffect |
| Entity.ParticleReset |
| Brief |
| Resets the particle effect. |
| Definition |
| Entity.ParticleReset( Entity entity ) |
| Arguments |
| entity - The entity to update. |
| Return Values |
| None. |
| Description |
| Resets the particle effect by clearing the particle buffer and resetting time to 0.0. |
| Examples |
| ! entity = Entity.Create() |
| | Entity.ParticleSetEffeet( entity, "myparticle" ) |
| j Entity.ParticleReset( entity ) |
| See Also |
| � Entity.Create |
| � Entity. ParticleSetEffect |
| Entity.ParticleSetAttachType |
| Brief |
| Sets how the particle is attached to the entity's world matrix. |
| Definition |
| Entity.ParticleSetAttachType( Entity entity, string type ) |
| Arguments |
| entity - The entity to update.type - The type of attachment the entity has over the particle effect. Can be one of the following: |
| "render" |
| "emitter" |
| Return Values |
| None. |
| Description |
| Sets how the particle is attached to the entity's world matrix. Can be one of the following: "render" - The entity's world matrix is used as the render |
| matrix of the particle effect. This is the default, "emitter� - The entity's world matrix is used as the emitter matrix of the particle effect. |
| Examples |
| e = Entity.Create() |
| Entity.ParticleSetEffeet( e, "flaming_torch" ) |
| Entity.ParticleSetAttachType( e, "emitter" ) |
| See Also |
| � Entity. ParticleSetEffect |
| Entity.ParticleSetEffect |
| Brief |
| Sets the entity's particle effect. |
| Definition |
| Entity.ParticleSetEffeet( Entity entity, string resourceName ) |
| Entity.ParticleSetEffeet( Entity entity. Resource particleResource ) |
| Arguments |
| entity - The entity to update.resourceName - The resource name of the particle effect or nil to remove it.particleResource - The particle effect |
| resource or nil to remove it. |
| Return Values |
| None. |
| Description |
| Sets the entity's particle effect to the named resource as specified in the HDK's Object Editor application. |
| Examples |
| ! entity = Entity.Create() |
| i Entity.ParticleSetEffeet( entity, "myparticle" ) |
| See Also |
| None |
| Entity.ParticleSetEmitting |
| Brief |
| Starts/Stops particle emission. |
| Definition |
| Entity.ParticleSetEmitting( Entity entity, boolean value ) |
| Arguments |
| entity - The entity to update.value - true to enable emission and false to stop emission. |
| Return Values |
| None. |
| Description |
| Starts/Stops particle emission. |
| Examples |
| | entity = Entity.Create() |
| Entity.ParticleSetEffeet( entity, "myparticle" ) |
| j Entity.ParticleSetEmitting( entity, false ) |
| See Also |
| � Entity.Create |
| Entity.ParticleSetUpdate |
| Brief |
| Starts/stops particle updating. |
| Definition |
| Entity.ParticleSetUpdate( Entity entity, boolean value ) |
| Arguments |
| entity - The entity to update.value - true to enable particle updates and false to disable them. |
| Return Values |
| None. |
| Description |
| Starts/stops particle updating. This effectively starts/stops time. |
| Examples |
| ! entity = Entity.Create() |
| Entity.ParticleSetEffeet( entity, "myparticle" ) |
| | Entity.ParticleSetUpdate( entity, false ) |
| See Also |
| � Entity.Create |
| � Entity. ParticleSetEffect |
| Entity.ParticleSetUserParam |
| Brief |
| Sets a user parameter in the particle system |
| Definition |
| boolean Entity.ParticleSetUserParam( Entity entity, string paramName, number paramValue ) |
| boolean Entity.ParticleSetUserParam( Entity entity, string paramName, Vector4 paramValue ) |
| Arguments |
| entity - The entity to update.paramName - The name of the parameter to set in the particle graph.paramValue - The value to set. |
| Return Values |
| true if the assignment was made, false if parameter not present in particle system. |
| Description |
| The particle editor tool allows for input of user parameters from runtime code. Access this via the "HomeLua..." nodes in the particle editor. There |
| are many supported types. 1->4 float components. (Scalar, Scale, Vector, Colour, etc...) The Scalar types can use the number or Vector4 |
| interface. All other types need to use the Vector4 interface. |
| Examples |
| entity = Entity.Create() |
| Entity.ParticleSetEffeet( entity, "myparticle" ) |
| Entity.ParticleSetUserParam( entity, "homelua_scalarl" |
| Entity.ParticleSetUserParam( entity, "homelua_scalar2" |
| Entity.ParticleSetUserParam( entity, "homelua_colourl" |
| Entity.ParticleSetUserParam( entity, "homelua_vector5" |
| 5.0 ) |
| Vector4(5.0) ) |
| Vector4(0.3,0.4,0.5,1.0) ) |
| Vector4(1.0,0.0,1.0) ) |
| See Also |
| None |
| Entity.PauseAnim |
| Brief |
| Pauses all current animation(s) if any are playing. |
| Definition |
| Entity.PauseAnim( Entity entity ) |
| Arguments |
| entity - The entity to update. |
| Return Values |
| None. |
| Description |
| Pauses all current animation(s) if any are playing. Use ResumeAnim to continue to play the animation(s). |
| Examples |
| entity = Entity.Create() |
| Entity.SetModel( entity, "mymodel" ) |
| Entity.SetSkeleton( entity, "myskel" ) |
| Entity.PlayAnim( entity, "myanim" ) |
| Entity.PauseAnim( entity ) |
| See Also |
| � Entity.ResumeAnim |
| Entity.PlayAnim |
| Brief |
| Plays the specified animation resource. |
| Definition |
| Entity.PlayAnim( Entity entity, |
| priority = 0 ) |
| Entity.PlayAnim( Entity entity, |
| priority = 0 ) |
| string resourceName, boolean looping = true, number time = 0, number |
| Resource animResource, boolean looping = true, number time = 0, number |
| Arguments |
| entity - The entity to update.resourceName - The resource name of the animation.animResource - The animation resource.looping - flag indicating |
| if animation should loop, or only play once. Default is true.time - the time at which the animation is played from. If the time is greater than the |
| duration, is taken as 0. Default is 0.priority - The priority affects where in the animation list an animation will be played. The higher the number, the |
| later it will be played. |
| If a prior animation is being played at the same priority, then the new animation will be placed after the old animation in the list, (default is 0). |
| *NB Internally, priority is treated as an integer. |
| Return Values |
| None. |
| Description |
| Plays the specified animation resource as specified in the HDK's Object Editor application. Stops all other animations that are currently playing. |
| Examples |
| entity = Entity.Create() |
| Entity.SetModel( entity, "mymodel" ) |
| Entity.SetSkeleton( entity, "myskel" ) |
| Entity.PlayAnim( entity, "myanim" ) |
| See Also |
| Entity.Create |
| � Entity. SetModel |
| � Entity.SetSkeleton |
| Entity.RegisterCollisionCallback |
| Brief |
| Register a function to be called in response to a collision event involving the specified entity. |
| Definition |
| Entity.RegisterCollisionCallback( Entity entity, EntityCollision eventType, function callback, |
| userData = nil ) |
| Arguments |
| entity - the entity to register for the collision callbackeventType - an EntityCollision enum value: |
| EntityCollision.ContactAdded - a new contact point has been added |
| EntityCollision.ContactProcess - called for all active contact points each frame while they exist |
| EntityCollision.ContactRemoved - a contact point has been removedcallback - the Lua function to be calleduserData - arbitrary user data of the |
| user's choice |
| Return Values |
| None. |
| Description |
| Register a function to be called in response to a collision event involving the specified entity. You must enable collision callbacks for the specified |
| entity using EnableCollisionCallbacksQ in order to begin receiving callbacks to your registered function(s). You must also set the maximum |
| contacts buffer using Entity.SetMaxContacts(). Finally, the entity must have collision set and enabled for the callbacks to occur. |
| Examples |
| � set up a collision data buffer |
| Entity.SetMaxContacts( 128 ) |
| foo = Entity.Create () |
| foo:SetModel("model") |
| foo:SetCollision("collision") |
| foo:SetPosition(Vector4.Create(0, 5, 0)) |
| foo:SetVisible(true) |
| foo:EnableCollision(true) |
| foo:EnableDynamics(true) |
| foo:EnableCollisionCallbacks(true) |
| foo:RegisterCollisionCallback(EntityCollision.ContactAdded, ContactAddedCallback, foo) |
| foo:RegisterCollisionCallback(EntityCollision.ContactRemoved, ContactRemovedCallback, foo) |
| See Also |
| � Entity. RegisterCollisionCallback |
| � Entity.SetMaxContacts |
| � Entity.SetCollision |
| � Entity.EnableCollision |
| Entity. Reset |
| Brief |
| Reset an entity to a newly-created state. |
| Definition |
| Entity.Reset(Entity entity) |
| Arguments |
| entity - Entity to reset. |
| Return Values |
| None. |
| Description |
| Resets all non-hierarchy entity state, including model, animation, collision, particles, attached cameras, lights and other state. The entity's |
| hierarchy state (parent and children) and transform state (position and rotation) will not be reset, if this is desired it must be done explicitly. Of |
| particular use if using a pool of entities, as entities can be reset upon being released back into the pool (or when allocated from the pool). |
| Examples |
| myEntity:Reset() |
| See Also |
| � Entity.Copy |
| Entity.ResumeAnim |
| Brief |
| Resumes all current animation(s) if they are paused. |
| Definition |
| Entity.ResumeAnim( Entity entity ) |
| Arguments |
| entity - The entity to update. |
| Return Values |
| None. |
| Description |
| Resumes all current animation(s) if they are paused. Use PauseAnim to pause the animation(s). |
| Examples |
| entity = Entity.Create() |
| Entity.SetModel( entity, "mymodel" ) |
| Entity.SetSkeleton( entity, "myskel" ) |
| Entity.PlayAnim( entity, "myanim" ) |
| Entity.PauseAnim( entity ) |
| Entity.ResumeAnim( entity ) |
| See Also |
| � Entity.PauseAnim |
| Entity.SetActionForce |
| Brief |
| Set the force of an entity action. |
| Definition |
| Entity.SetActionForce( Entity entity, number actionld, Vector4 force ) |
| Arguments |
| entity - The entity to which the action belongsactionld - The numerical action IDforce - The force in world-space |
| Return Values |
| None. |
| Description |
| Set the force of an entity action. Only applicable to force-based actions. This function is only available if the entity has a collision item. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource" ) |
| e:EnableDynamics() |
| actionld = Entity.CreatePointForceAction( e, false ) |
| f = Vector4.Create( 10.0, 0.0, 0.0 ) |
| p = Vector4.Create( 0.0, 1.0, 0.0 ) |
| Entity.EnableAction( e, actionld ) |
| Entity.SetActionForce( e, actionld, f ) |
| Entity.SetActionPosition( e, actionld, p ) |
| Entity.DestroyAction( e, actionld ) |
| See Also |
| � Entity. SetActionTorque |
| � Entity.SetActionPosition |
| Entity.SetActionPosition |
| Brief |
| Set the position of an entity action. |
| Definition |
| Entity.SetActionPosition( Entity entity, number actionld, Vector4 position ) |
| Arguments |
| entity - The entity to which the action belongsactionld - The numerical action IDposition - The position in world-space. |
| Return Values |
| None. |
| Description |
| Set the position of an entity action. Only applicable to position-based actions. This function is only available if the entity has a collision item. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource" ) |
| e:EnableDynamics() |
| actionld = Entity.CreatePointForceAction( e, false ) |
| f = Vector4.Create( 10.0, 0.0, 0.0 ) |
| p = Vector4.Create( 0.0, 1.0, 0.0 ) |
| Entity.EnableAction( e, actionld ) |
| Entity.SetActionForce( e, actionld, f ) |
| Entity.SetActionPosition( e, actionld, p ) |
| Entity.DestroyAction( e, actionld ) |
| See Also |
| � Entity.SetActionTorque |
| � Entity.SetActionForce |
| Entity.SetActionTorque |
| Brief |
| Set the torque of an entity action. |
| Definition |
| Entity.SetActionTorque( Entity entity, number actionld, Vector4 torque ) |
| Arguments |
| entity - The entity to which the action belongsactionld - The numerical action IDtorque - The torque in world-space. |
| Return Values |
| None. |
| Description |
| Set the torque of an entity action. Only applicable to torque-based actions. This function is only available if the entity has a collision item. |
| Examples |
| entity = Entity.Create() |
| e:SetCollision("kCollisionResource" ) |
| e:EnableDynamics() |
| actionld = Entity.CreateTorqueAction( e, false ) |
| t = Vector4.Create( 10.0, 0.0, 0.0 ) |
| p = Vector4.Create( 0.0, 1.0, 0.0 ) |
| Entity.EnableAction( e, actionld ) |
| Entity.SetActionTorque( e, actionld, t ) |
| Entity.DestroyAction( e, actionld ) |
| See Also |
| � Entity.SetActionForce |
| � Entity.SetActionPosition |
| Entity. SetAngularDamping |
| Brief |
| Sets the angular damping of the collision resource attached to the entity. |
| Definition |
| ! Entity.SetAngularDamping( Entity entity, number damping ) |
| Arguments |
| entity - The entity to update.damping - The angular damping to apply to the entity. |
| Return Values |
| None. |
| Description |
| Sets the angular damping of the collision resource attached to the entity. Angular damping reduces the rotational velocity of the entity over time. |
| For example, if you set the angular damping to 0.2, then every second about 20% of the object's angular velocity will be removed. This function is |
| only valid if the entity has a collision item. |
| Examples |
| ! Entity.SetAngularDamping( entity, 0.2 ) |
| See Also |
| � Entity.EnableCollision |
| � Entity.EnableDynamics |
| � Entity.SetCollision |
| � Entity.GetAngularDamping |
| Entity.SetAngularVelocity |
| Brief |
| Sets the angular velocity around the center of mass of the entity. |
| Definition |
| Entity.SetAngularVelocity( Entity entity, Vector4 velocity ) |
| Arguments |
| entity - The entity to update.velocity - vector specifying angular velocity. |
| Return Values |
| None. |
| Description |
| Sets the angular velocity around the center of mass of the entity's rigid body in world space. The W component of the specified vector is ignored. |
| Examples |
| ! � Add the entity to the physics simulation |
| i Entity.EnableCollision( entity, true ) |
| | Entity.EnableDynamics( entity, true ) |
| | Entity.SetAngularVelocity( entity, Vector4.Create( 0, 10, 0 ) ) |
| See Also |
| � Entity. SetLinearVelocity |
| � Vector4.Create |
| Entity .Set AttachT ype |
| Brief |
| Set the type of attachment used by the entity. |
| Definition |
| Entity.SetAttachType( Entity entity, AttachType type ) |
| Arguments |
| entity - The entity to affect (must be attached to another entity or person).type - The type of attachment to use: |
| AttachType.T ranslation |
| AttachType. Rotation |
| AttachType.Scale |
| AttachType.Transform (default) |
| Return Values |
| None. |
| Description |
| The default behaviour for attached entities is to inherit all of their parent's transform, including translation, rotation and scaling. A script can use |
| this function to only inherit some of the parent's transform, to only translate an object with its parent and not alter its rotation for example. Scale is |
| handled so that if translation and scale are both inherited, then the local translation of the child entity will be scaled also, as per normal |
| attachment. If translation is not inherited, the local translation will not be scaled. |
| Examples |
| child:AttachToParent(parent) |
| child:SetAttachType(AttachType.Translation) � only inherit parent translation |
| child:SetAttachType(AttachType.Translation + AttachType.Rotation) � ignore parent scale |
| child:SetAttachType(AttachType.Transform) � same as default |
| See Also |
| � Entity.AttachToParent |
| � Entity.AttachToBone |
| Entity.SetCenterOfMassLocal |
| Brief |
| Sets the position of the entity's center of mass in local space. |
| Definition |
| Entity.SetCenterOfMassLocal( Entity entity, Vector4 com ) |
| Arguments |
| entity - The entity to update.com - The position of the entity's center of mass in local space. |
| Return Values |
| None. |
| Description |
| Sets the position of the entity's center of mass in local space. This may be offset from the coordinate origin of the entity depending on its physics |
| configuration. This function is only available if the entity has a collision item. |
| Examples |
| : Entity.SetCenterOfMassLocal( entity, Vector4.Create( 0.5, 0.5, 0.5 ) ) |
| See Also |
| � Entity. EnableDynamics |
| Entity.SetCollision |
| Brief |
| Sets the entity's collision. |
| Definition |
| Entity.SetCollision( Entity entity, string resourceName, Phys3dWorld world = nil ) |
| Entity.SetCollision( Entity entity, Resource collisionResource, Phys3dWorld world = nil ) |
| Arguments |
| entity - The entity to update.resourceName - The collision's resource name or nil to remove it.collisionResource - The collision resource or nil to |
| remove it.world - Phys3dWorld to add the entity to, or nil for the default. |
| Return Values |
| None. |
| Description |
| Sets the entity's collision to the named resource as specified in the HDK�s Object Editor application. Note that an entity with collision will no longer |
| respect attachments specified prior to calling SetCollision. The current world transform of the entity is preserved across this function call. This |
| function will automatically enable collision on the entity. |
| Examples |
| entity = Entity.Create() |
| Entity.SetCollision( entity, "mycollision" ) |
| � Remove the collision from the entity |
| Entity.SetCollision( entity, nil ) |
| See Also |
| � Entity.Create |
| � Phys3dWorld.Create |
| Entity.SetCollision Layer |
| Brief |
| Set the collision layer of an entity. |
| Definition |
| Entity.SetCollisionLayer( Entity entity, enum layer, boolean preserveCurrentLayerCollisions = true ) |
| Arguments |
| entity - The entity.layer - The collision layer; can be either CollisionLayer.Entity or a "User Layer".preserveCurrentLayerCollisions - true to |
| preserve which layers the entity collides with, false otherwise. |
| Return Values |
| None. |
| Description |
| Set the collision layer of an entity. If preserveCurrentLayerCollisions is false, the layers with which the entity collides are reset to the default for the |
| specified layer. The defaults can be changed using Scene.SetLayerCollisionDefault. |
| Examples |
| Entity.SetCollisionLayer( entity, CollisionLayer.Userl, false ) |
| See Also |
| � Entity.GetCollisionLayer |
| � Scene.SetLayerCollisionDefault |
| Entity.SetCullDistance |
| Brief |
| Set a distance at which the entity will be automatically made invisible. |
| Definition |
| ! Entity.SetCullDistance(Entity entity, number distance) |
| Arguments |
| entity - The entity to modify.distance - The distance from camera at which to visibility cull the entity, or 0 to disable. |
| Return Values |
| None. |
| Description |
| For situations involving a large scene, it may be beneficial for efficiency reasons to set objects to invisible when they are located far away. Setting |
| a cull distance will automatically compute the entity's distance from camera every frame and hide it and any child entities if the distance is greater |
| than the specified cull distance. Note that internally squared distances are compared, so the cull distance should not overflow a floating point |
| number when squared. |
| Examples |
| ! myEntity:SetCullDistance(80) � set cull distance to 80m |
| See Also |
| � Entity.GetCullDistance |
| Entity.SetDynamicsActive |
| Brief |
| Activate/deactivate dynamics on the specified entity. |
| Definition |
| ! Entity.SetDynamicsActive( Entity entity, boolean activate = true ) |
| Arguments |
| entity - The entity to update.activate - true to activate dynamics, false otherwise (defaults to true if not specified). |
| Return Values |
| None. |
| Description |
| Dynamics must be enabled with Entity.EnableDynamicsf) for the activated/deactivated state to take effect. An Entity with activated dynamics is |
| one that is having it�s motion updated. If dynamics are deactivated with this function, Flome's physics engine will stop updating the Entity's motion, |
| until it is activated again. Entities can be activated by another call to this function or by the application of forces/torques/impulses or by coming |
| into contact with other activated Entities. Entities can be deactivated with this function or by allowing auto-deactivation which will deactivate the |
| Entity if it has not been moving for a while. Auto-deactivation can be enabled/disabled with Entity.EnableDynamicsAutoDeactivation. This function |
| is only valid if the entity has a collision item. |
| Examples |
| � Deactivate dynamics |
| Entity.SetDynamicsActive( entity, false ) |
| � Activate dynamics (collision must be enabled as well) |
| Entity.EnableCollision( entity ) |
| Entity.EnableDynamics( entity ) |
| Entity.SetDynamicsActive( entity ) |
| See Also |
| � Entity.EnableDynamics |
| � Entity. EnableDynamicsAutoDeactivation |
| Entity.SetFrictionCoeff |
| Brief |
| Set the friction coefficient of the collision resource attached to the entity. |
| Definition |
| Entity.SetFrictionCoeff( Entity entity, number f ) |
| Arguments |
| entity - The entity to updated - the coefficient of friction. |
| Return Values |
| None. |
| Description |
| Set the coefficient of friction for the surface of the rigid body that is attached to the entity. This affects the entity's motion relative to surfaces it |
| comes into contact with. Although this is actually a pair-wise coefficient, friction is specified on a per rigid body basis. When affecting the relative |
| motion of two surfaces, the surfaces' friction coefficients are combined to produce a coefficient for the interaction. Usual values for friction are |
| between 0 and 1. Values greater than 1, although physically invalid, are allowed. However, values must be less than or equal to 255. |
| Examples |
| Entity.SetFrictionCoeff( entity, 0.0 ) |
| See Also |
| � Entity.EnableCollision |
| � Entity.EnableDynamics |
| � Entity. SetCollision |
| Entity.SetGravity |
| Brief |
| Set the gravity vector to apply to the entity. |
| Definition |
| Entity.SetGravity( Entity entity, Vector4 gravityVector ) |
| Arguments |
| entity - entity to be affected.gravityVector - new gravity vector. |
| Return Values |
| None. |
| Description |
| Only the specified entity is affected by the new gravity force. |
| Examples |
| ! � set gravity to half strength |
| j local g = Scene.GetGravity() * 0.5 |
| j entity:SetGravity( g ) |
| See Also |
| � Entity.GetGravity |
| Entity.SetLight |
| Brief |
| Set the entity's light. |
| Definition |
| Entity.SetLight( Entity entity, Light light = nil ) |
| Arguments |
| entity - The entity to update.light - The Light to attach to the entity or nil to detach the existing light. |
| Return Values |
| None. |
| Description |
| Set the entity's light. |
| Examples |
| i entity = Entity.Create() |
| ! Entity.SetLight( entity, light ) |
| See Also |
| Entity.Create |
| Entity. SetLinearDamping |
| Brief |
| Sets the linear damping of the collision resource attached to the entity. |
| Definition |
| ! Entity.SetLinearDamping( Entity entity, number damping ) |
| Arguments |
| entity - The entity to update.damping - The linear damping to apply to the entity. |
| Return Values |
| None. |
| Description |
| Sets the linear damping of the collision resource attached to the entity. Linear damping reduces the linear velocity of the entity over time. For |
| example, if you set the linear damping to 0.2, then every second about 20% of the object's linear velocity will be removed. This function is only |
| valid if the entity has a collision item. |
| Examples |
| ! Entity.SetLinearDamping( entity, 0.2 ) |
| See Also |
| � Entity.EnableCollision |
| � Entity. EnableDynamics |
| � Entity.SetCollision |
| � Entity.GetLinearDamping |
| Entity.SetLinearVelocity |
| Brief |
| Sets the linear velocity of this object. |
| Definition |
| ! Entity.SetLinearVelocity( Entity entity, Vector4 velocity ) |
| Arguments |
| entity - The entity to update.velocity - Vector specifying linear velocity. |
| Return Values |
| None. |
| Description |
| Sets the linear velocity of the center of mass of the entity's rigid body in world space. The W component of the specified vector is ignored. |
| Examples |
| � Add the entity to the physics simulation |
| Entity.EnableCollision( entity, true ) |
| Entity.EnableDynamics( entity, true ) |
| Entity.SetLinearVelocity( entity, Vector4.Create( 0, 10, 0 ) ) |
| See Also |
| � Entity.SetAngularVelocity |
| � Vector4.Create |
| Entity.SetLocalMatrix |
| Brief |
| Sets the entity's local transformation matrix. |
| Definition |
| Entity.SetLocalMatrix( Entity entity, Matrix44 matrix ) |
| Arguments |
| entity - The entity to update.matrix - The matrix to set the entity's transform to. |
| Return Values |
| None. |
| Description |
| Sets the entity's local transformation matrix. The specified matrix is relative to the coordinate system of the entity's parent, if one exists. If the |
| entity has no parent, the matrix is relative to the world space coordinate system. |
| Examples |
| entity = Entity.Create() |
| matrix = Matrix44.Create() |
| � Set up a uniform scale matrix |
| Matrix44.SetScale( matrix, 2, 2, 2, 1, MATRIX_REPLACE ) |
| Entity.SetLocalMatrix( entity, matrix ) |
| print( mat ) |
| See Also |
| � Entity.Create |
| � Matrix44.Create |
| � Matrix44.SetScale |
| Entity.SetMass |
| Brief |
| Sets the mass of the collision resource attached to the entity. |
| Definition |
| ! Entity.SetMass( Entity entity, number mass ) |
| Arguments |
| entity - The entity to update.mass - The mass of the entity's collision resource in kilograms. |
| Return Values |
| None. |
| Description |
| Sets the mass of the collision resource that is attached to the specified entity. Very large or very small masses should be avoided, as these can |
| create instability in the simulation. This function can only be called if the entity has a collision resource. |
| Examples |
| ! Entity.SetMass( entity, 5 ) |
| See Also |
| � Entity.EnableCollision |
| � Entity. EnableDynamics |
| � Entity.SetCollision |
| � Entity.GetMass |
| Entity.SetMaxContacts |
| Brief |
| Specify the maximum number of contacts to buffer for collision callbacks. |
| Definition |
| boolean Entity.SetMaxContacts(number maxContacts) |
| Arguments |
| maxContacts - maximum number of contact events to buffer |
| Return Values |
| true if sufficient memory could be allocated or false otherwise. |
| Description |
| Allocates an internal buffer to record contact events for provision via collision callbacks. Each contact event generated by PS Home for the types |
| for which the script has registered callbacks will be buffered in this internal buffer, until the contacts are passed to the script via the callbacks. All |
| entities registered for callbacks in the current script environment will share this buffer. If more contacts are generated than the buffer can store, |
| subsequent contacts will not be buffered and will not be available to the script, and a message indicating this will be displayed in the console. |
| Note that each contact currently requires 64 bytes of memory. If this function fails, there was insufficient memory available to the script to allocate |
| the buffer. In this case, collision callbacks will be disabled until a subsequent call to this function (with a lower maximum) succeeds. This function |
| is not available from within a collision callback and will generate an error. |
| Examples |
| ! Entity.SetMaxContacts(128) � enough memory for 128 contact events (added/processed/removed) per |
| ; frame |
| See Also |
| � Entity. RegisterCollisionCallback |
| � Entity. EnableCollisionCallbacks |
| � Entity.SetColiision |
| � Entity. EnableCollision |
| Entity.SetModel |
| Brief |
| Set the entity's model. |
| Definition |
| Entity.SetModel( Entity entity, string resourceName ) |
| Entity.SetModel( Entity entity, Resource modelResource ) |
| Arguments |
| entity - The entity to update.resourceName - The model's resource name or nil to remove the model.modelResource - The model resource or nil |
| to remove the model. |
| Return Values |
| None. |
| Description |
| Set the entity's model to the named resource as specified in the HDK's Object Editor application. |
| Examples |
| ! entity = Entity.Create() |
| i Entity.SetModel( entity, "mymodel" ) |
| ! � Remove the model from the entity |
| ; Entity.SetModel( entity, nil ) |
| See Also |
| � Entity.Create |
| Entity.SetPosition |
| Brief |
| Sets the entity's position. |
| Definition |
| Entity.SetPosition( Entity entity, Vector4 position ) |
| Arguments |
| entity - The entity to update.position - The new position for the entity. |
| Return Values |
| None. |
| Description |
| Sets the entity's position. If the entity has a parent, the specified position is relative to local coordinate system of the parent. |
| Examples |
| ! entity = Entity.Create() |
| Entity.SetPosition( entity, Vector4.Create( 10, 10, 0 ) ) |
| See Also |
| � Entity.Create |
| Entity.SetRestitutionCoeff |
| Brief |
| Sets the restitution coefficient of the collision resource attached to the entity. |
| Definition |
| ! Entity.SetRestitutionCoeff( Entity entity, number r ) |
| Arguments |
| entity - The entity to update.r - the coefficient of restitution. |
| Return Values |
| None. |
| Description |
| Sets the restitution (or elasticity) coefficient for the rigid body attached to the entity. This governs the effect that collisions have on the velocities of |
| colliding entities. Like friction, this is a pair-wise coefficient - when two physical entities collide, their restitution values are combined to produce a |
| coefficient for the interaction. Usual values for restitution are between 0 and 1. Values greater than 1, although physically invalid, are allowed. |
| However, values must be less than 1.99. |
| Examples |
| � Prevent entity from bouncing |
| Entity.SetRestitutionCoeff( entity, 0.0 ) |
| See Also |
| Entity. EnableCollision |
| � Entity.EnableDynamics |
| � Entity.SetCollision |
| Entity.SetRotationQuat |
| Brief |
| Sets the rotation using the supplied quaternion. |
| Definition |
| | Entity.SetRotationQuat( Entity entity, Quaternion quat ) |
| Arguments |
| entity - The entity to update.quat - The quaternion. |
| Return Values |
| None. |
| Description |
| Sets the rotation of the specified entity using the supplied quaternion. |
| Examples |
| ! entity = Entity.Create() |
| j quat = Quaternion.Create() |
| | entity:SetRotationQuat(quat) |
| See Also |
| � Entity.GetRotationQuat |
| Entity.SetRotationX |
| Brief |
| Sets the rotation about the x-axis in degrees. |
| Definition |
| ! Entity.SetRotationX( Entity entity, number rotation ) |
| Arguments |
| entity - The entity to update.rotation - The specified angle of rotation about the x-axis in degrees. |
| Return Values |
| None. |
| Description |
| Sets the rotation about the x-axis of the entity's local coordinate system in degrees. The rotation order is x, y, z. |
| Examples |
| entity = Entity.Create() |
| Entity.SetRotationX( entity, 90.0 ) |
| See Also |
| � Entity.Create |
| Entity.SetRotationXyz |
| Brief |
| Sets the rotation about the x, y, and z-axis in degrees. |
| Definition |
| Entity.SetRotationXyz( Entity entity, Vector4 rotation ) |
| Arguments |
| entity - The entity to update.rotation - The specified x, y, and z angles of rotation in degrees. |
| Return Values |
| None. |
| Description |
| Sets the rotation about the x, y, and z-axis of the entity's local coordinate system in degrees. The rotation order is x, y, z. |
| Examples |
| ! entity = Entity.Create() |
| i Entity.SetRotationXyz( entity, Vector4.Create( 45, 30, 90 ) ) |
| See Also |
| � Entity.Create |
| Entity.SetRotationY |
| Brief |
| Sets the rotation about the y-axis in degrees. |
| Definition |
| ! Entity.SetRotationY( Entity entity, number rotation ) |
| Arguments |
| entity - The entity to update.rotation - The specified angle of rotation about the y-axis in degrees. |
| Return Values |
| None. |
| Description |
| Sets the rotation about the y-axis of the entity's local coordinate system in degrees. The rotation order is x, y, z. |
| Examples |
| : entity = Entity.Create() |
| i Entity.SetRotationY( entity, 90.0 ) |
| See Also |
| � Entity.Create |
| Entity.SetRotationZ |
| Brief |
| Sets the rotation about the z-axis in degrees. |
| Definition |
| Entity.SetRotationZ( Entity entity, number rotation ) |
| Arguments |
| entity - The entity to update.rotation - The specified angle of rotation about the z-axis in degrees. |
| Return Values |
| None. |
| Description |
| Sets the rotation about the z-axis of the entity's local coordinate system in degrees. The rotation order is x, y, z. |
| Examples |
| ! entity = Entity.Create() |
| i Entity.SetRotationZ( entity, 90.0 ) |
| See Also |
| � Entity.Create |
| Entity.SetScale |
| Brief |
| Sets the entity's scale. |
| Definition |
| Entity.SetScale( Entity entity, Vector4 scale ) |
| Arguments |
| entity - The entity to update.scale - The new scale of the entity. |
| Return Values |
| None. |
| Description |
| Sets the entity's scale. The specified scale is applied to the local transformation matrix of the entity. On creation, an entity has a scale of (1,1,1) |
| or no scaling, in other words. Note that the W component of the specified vector is ignored. Note that scale should not be applied to entities with |
| collision enabled. |
| Examples |
| entity = Entity.Create() |
| Entity.SetScale( entity, Vector4.Create( 45, 30, 90 ) ) |
| See Also |
| � Entity.Create |
| � Vector4. Create |
| Entity.SetScreen |
| Brief |
| Set the entity's screen. |
| Definition |
| Entity.SetScreen( Entity entity, Screen screen ) |
| Arguments |
| entity - The entity to update.screen - The screen to attach to the entity or nil to remove it. |
| Return Values |
| None. |
| Description |
| Set the entity's screen. The screen's corner coordinates will be transformed by the entity's world transformation matrix. |
| Examples |
| j entity = Entity.Create() |
| i Entity.SetScreen( entity, screen ) |
| ! � Remove the screen from the entity |
| Entity.SetScreen( entity, nil ) |
| See Also |
| Entity.Create |
| Entity.SetSkeleton |
| Brief |
| Set the entity's skeleton. |
| Definition |
| Entity.SetSkeleton( Entity entity, string resourceName ) |
| Entity.SetSkeleton( Entity entity. Resource skeletonResource ) |
| Arguments |
| entity - The entity to update.resourceName - The skeleton's resource name or nil to remove it.skeletonResource - Pre-loaded skeleton resource |
| object. |
| Return Values |
| None. |
| Description |
| Set the entity's skeleton to the named resource as specified in the HDK's Object Editor application. |
| Examples |
| ! entity = Entity.Create() |
| i Entity.SetSkeleton( entity, "myskel" ) |
| ! � Remove the skeleton from the entity |
| i Entity.SetSkeleton( entity, nil ) |
| See Also |
| � Entity.Create |
| Entity.SetVisible |
| Brief |
| Sets the entity to visible or invisible. |
| Definition |
| Entity.SetVisible( Entity entity, boolean value ) |
| Arguments |
| entity - The entity to update.value - If true the entity is visible and it false it is invisible. |
| Return Values |
| None. |
| Description |
| Sets the entity to visible or invisible. Entities default to visible when created. |
| Examples |
| entity = Entity.Create() |
| Entity.SetVisible( entity, false ) |
| See Also |
| � Entity.Create |
| Entity.StopAnim |
| Brief |
| Stops the current animation if it is playing. |
| Definition |
| Entity.StopAnim( Entity entity ) |
| Entity.StopAnim( Entity entity, Animation anim ) |
| Arguments |
| entity - The entity to update.anim - The animation to stop. |
| Return Values |
| None. |
| Description |
| If the Animation anim passed in is nil, or invalid, nothing is done. If an animation is specified, it will be stopped immediately with no blend out. If no |
| animation is specified, all animations on the entity will be stopped immediately, with no blend out. |
| Examples |
| entity = Entity.Create() |
| local animHandle = Animation.Create() |
| Entity.SetModel( entity, "mymodel" ) |
| Entity.SetSkeleton( entity, "myskel" ) |
| Entity.PlayAnim( entity, "mylstAnim" ) |
| Entity. BlendAnim ( entity, "my2ndAnim ,, , true, 0, 0, animHandle ) |
| Entity.StopAnim( entity, animHandle ) � stops specific animation |
| Entity.StopAnim( entity ) � stops all other animations |
| See Also |
| � Entity.Create |
| � Entity.PlayAnim |
| � Entity.SetModel |
| � Entity.SetSkeleton |