This class is the base for most moving objects and provides properties and functions for handling movement and collisions.
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.
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 floors and ceilings.
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 horizontal position of this object.
The vertical position of this object.
The X coordinate of where the rope is attached, divide it by 65536, then round up or convert to int to get the number of pixels. Since 18.104.22.168, WA doesn't allow the rope to be attached to the air. If you'd like to make the scripts such as "ropetest" properly work on the latest PX, you will need to emulate an older version.
The Y coordinate of where the rope is attached, divide it by 65536, then round up or convert to int to get the number of pixels. Since 22.214.171.124, WA doesn't allow the rope to be attached to the air. If you'd like to make the scripts such as "ropetest" properly work on the latest PX, you will need to emulate an older version.
Tells whether the rope is attached or not. If yes, the value will be "1". If not, the value will be "0".
Number of rope fragments in the current rope or bungee. One rope fragment is 8 pixels in length. If you enlarge or shorten the rope/bungee, the number of fragments will change respectively. The max number of rope fragments in W:A is currently 58.
The current length of the rope. Takes relatively big values, divide them by 65536 to get the number of pixels.
The speed at which this object sinks when under water.
Equal to 1 when the object is sinking, 0 otherwise.
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.
For CWorm: if speed is more than 7, the worm loses control.
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. Supposedly equal to 1 when the object has stopped moving, 0 otherwise.
How much this object is influenced by wind.
- 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:
Override this in your custom class to define custom behaviour on collisions.
CGObject has empty collide function (it doesnt do anything).
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.
Type is the side of this object, which reflected obj.
1 - bottom.
2 - left.
3 - top.
4 - right.
Main difference between Collide and Reflect is easy to understand in this example:
If grenade is falling onto the barrel, Collide will be called in CMissile, and Reflect will be called in COilDrum (and there will be no Collide for COilDrum, if its not moving).
CGObject has empty reflect function (it doesnt do anything).
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.