- 最后登录
- 2024-6-3
- 注册时间
- 2009-10-16
- 阅读权限
- 100
- 积分
- 18803
- 纳金币
- 17488
- 精华
- 1
|
Collider for Simulations (Physics Behavior)
Summary
Causes the parent object to interact with any Collision Shells in a semi-realistic manner.
Category
Latest Behaviors
Author
Gavin Kistner
Difficulty
(Reference)
Time to Complete
5 Minutes
Downloads
Click Here
to download the associated files.
(This document covers version 3.1.2 of the 'Collider for Simulations' behavior, current as of 2005-Feb-11)
Description
Attach this behavior to an object to cause it to collide with any objects which have the Collision Shell behavior attached.
When an object collides with a collision shell:
the Collision Shell fires a ‘Collided With’ event
this behavior and the object to which it is attached both fire a ‘Collided’ event
the object ‘bounces’ off of the Collision Shell, with the amount of bounce being proportional to the
Elasticity
setting of the Collision Shell behavior
While the polygons of the Collision Shell are used to find the collision, the geometry of the Collider object is
NOT
used. Instead, a ray is projected from the center of the object out to its collision radius, along the direction of movement for the object. It is this ray which is used to detect collisions.
If the
Extra Detection?
advanced property is checked, an additional 6 rays are positioned around the object, offset from its center along the global axes.
It does not matter whether the parent object is moved due to its positionVelocity, or animation/script setting its position directly; the difference between the previous position of the object and its new position is used in all cases to determine whether the object has moved.
Note that the parent object must be in ‘global space’; that is, it may not be attached under any parent element which is rotated scaled, or offset. (No such restriction exists for the shells.)
When the object bounces off an object, the object is set into motion by setting its position velocity. By default, the amount of reflection will be determined by the
Elasticity
property of the shell which was collided with. The
Override Elasticity?
advanced property may be used to set an elasticity which always applies to the collider, regardless of the elasticity of any shell.
Note that the collision detection is only based on the movement of the collider itself,
NOT
the collision shells. If you have a collider sitting still (a baseball) and you move/rotate a collision shell into it (a baseball bat) the ball will not experience a collision. Similarly if the ball is moving very slowly towards a collision shell which is itself moving very quickly, if a collision occurs (which will only occur if the movement of the object overlaps a face of the shell during one frame) the object will bounce off only in proportion to its own speed,
NOT
the combined speed of the object and the collision shell which hit it.
Finally, while this behavior attempts to simulate realistic collisions and reflections, there are known inaccuracies and edge cases which can cause it to react somewhat incorrectly (the reflection is slightly off) or very incorrectly (the collider passes right through a collision shell). This behavior is not a substitute for real physical simulation.
Instead of this behavior, use the Collider for Walkthroughs behavior attached to a Camera for better results when creating a ‘walkthrough’ presentation.
Basic Properties
Collision Distance
How far from the center of the object should a collision be looked for?
Advanced Properties
Flash On Collision?
Flash to a color the parent collides?
Flash Color
Color to flash when a collision occurs.
Override Elasticity?
Use the 'Elasticity' value (below) rather than that of the collider?
Elasticity
Elasticity value to use instead of those on any collider.
Extra Detection?
Use 7 rays for collision instead of 1? (seven times slower)
Events
Collided
Fires when the parent object collides with a collision shell.
Demonstration
View Demonstration Project
Download Project File
|
|