CGObject
Experimental page |
Detailed description
This class is the base for most moving objects and provides properties and functions for handling movement and collisions.
Field documentation
The collision flags this object should use for filtering collisions. This is a misnamed field, the actual collision group is Layer.
Each bit corresponds to a collision group, a bit set to 1 will enable collisions with the collision group attributed to this bit. For instance, setting bit 17 to 1 (by performing a bitwise OR with 0x00020000) will enable collisions with oil drums.
See Collision flags for more information.
The collision mask used by this object.
Unknown.
Affect the object's bounciness from walls.
CWorm->DumpingA = 0.6
CMine->DumpingA = 0.6
COilDrum->DumpingA = 0.0
CCrate has same values as COilDrum.
Affect the object's bounciness from floor.
CWorm->DumpingB = 0.0
CMine->DumpingB = 0.6
COilDrum->DumpingB = 0.5
Affect the object's friction.
If it set to 0.0 the object will not roll\slide after colliding with floor-ceiling.
CWorm->DumpingC = 1.0
CMine->DumpingC = 1.0
COilDrum->DumpingC = 1.0
How much this object is influenced by gravity.
Equal to 1 when the object is not resting on the ground, 0 otherwise.
True if collisions are enabled on this object, false otherwise. Setting this to false will effectively prevent this object from colliding with anything. Also SpX and SpY changes do nothing and object dont affected by gravity.
The collision group this object belongs to. This allows certain objects to collide with this object.
Do not confuse this with ColGroup, this should be an integer between 0 and 31. For instance, an object with a Layer equal to 17 will be considered as an oil drum by other objects, collision-wise.
See Collision flags for more information.
The index of the collision mask this object should use. This is obsolete if the object uses a custom collision mask. (see ColMask)
The following values have been tested:
- 2 = Mine
- 9 = Oil drum
The current state of this object.
This should not be set directly, use SetState instead.
See EObjState for more information.
The horizontal position of this object.
The vertical position of this object.
Unused.
Unused.
Unused.
Unused.
Unused.
Unused.
Unused.
The speed at which this object sinks when under water.
Equal to 1 when the object is sinking, 0 otherwise.
Unknown.
This should be passed as the 5th argument to PlayLocalSound. Does not seem to have any other use.
The current horizontal speed of this object.
The current vertical speed of this object.
The speed of this object is divided by this value every frame. Usually set to 1 for most objects.
Setting this to a very high value such as 1000 will effectively freeze the object in place.
Unknown.
Unknown. Supposedly equal to 1 when the object has stopped moving, 0 otherwise.
How much this object is influenced by wind.
Method documentation
- layer is the collision group this object should be attributed to. See Layer.
- maskIndex is the index of the collision mask which should be given to this object. See ColMask
See CObject for more information.
This is called whenever the object collides with another object.
- obj is the object this object collided with.
- type is the which side of this object collided with "obj". The possible values: 1, 2, 3, 4:
---1---
4-----2
---3---
Override this in your custom class to define custom behaviour on collisions.
This is called whenever the object falls into the water and sinks.
Override this in your custom class to define custom behaviour when your object sinks.
Plays a sound centered around this object's position.
- index is the index of the sound to play.
- unk, unkB and unkC are unknown arguments, they are usually set respectively to 5, 1 and 1.
- sounder should be always Snd.
That method called by the game every time object reflecting another object.
Obj is the object this object reflected.
Types:
1 - CGObject:: reflecting obj down (or from bottom).
2 - CGObject:: reflecting obj left (or from left).
3 - CGObject:: reflecting obj up (or from top).
4 - CGObject:: reflecting obj right (or from right).
Changes the state of an object. Can be also overriden to define custom behaviour whenever the state of an object changes.
See EObjState for more information.