Nuclide
Software Development Kit for id Technology (BETA)
Loading...
Searching...
No Matches
PhysicsConstraint.h
1/*
2 * Copyright (c) 2023 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16typedef enum
17{
18 CONSTRAINT_FIXED = -1,
19 CONSTRAINT_INVALID,
20 CONSTRAINT_POINT,
21 CONSTRAINT_HINGE,
22 CONSTRAINT_SLIDER,
23 CONSTRAINT_UNIVERSAL,
24 CONSTRAINT_HINGE2
25} constraint_t;
26
35class
37{
38public:
39 void ncPhysicsConstraint(void);
40
41 virtual void SpawnKey(string, string);
42
43#ifdef SERVER
44 virtual void Save(float);
45 virtual void Restore(string,string);
46 virtual void Input(entity, string, string);
47#endif
48
49 virtual void Spawned(void);
50 virtual void OnRemoveEntity(void);
51
53 nonvirtual void WakeTargets(void);
54
56 nonvirtual void Break(entity);
57
59 nonvirtual constraint_t GetConstraintType(void);
61 nonvirtual entity GetEntity1(void);
63 nonvirtual entity GetEntity2(void);
64
66 nonvirtual void SetConstraintType(constraint_t);
68 nonvirtual void SetEntity1(entity);
70 nonvirtual void SetEntity2(entity);
71 //nonvirtual void SetBone1(float);
72 //nonvirtual void SetBone2(float);
73
75 nonvirtual void SetSliderVelocity(float);
77 nonvirtual void SetSliderMaxVelocity(float);
79 nonvirtual void SetSliderStop(float);
81 nonvirtual void SetSliderFriction(float);
82
84 nonvirtual float GetSliderVelocity(void);
86 nonvirtual float GetSliderMaxVelocity(void);
88 nonvirtual float GetSliderStop(void);
90 nonvirtual float GetSliderFriction(void);
92 nonvirtual float GetConstraintSystemID(void);
93
95 nonvirtual ncPhysicsConstraint Ballsocket(entity, entity, vector, vector, float, bool);
97 nonvirtual ncPhysicsConstraint Weld(entity, entity, float, float, float, bool, bool);
99 nonvirtual ncPhysicsConstraint Rope(entity, entity, vector, vector);
100
101 nonvirtual ncPhysicsConstraint KeepUpright(entity, vector, float);
102
103 nonvirtual void ConstraintThink(void);
104
105private:
106
107 float m_flTorqueLimit;
108 float m_flForceLimit;
109 string m_strEnt1;
110 string m_strEnt2;
111 string m_strBreakSound;
112 string m_outputOnBreak;
113 string m_strConstraintSystem;
114};
void ncEntity(void)
The constructor.
Definition Entity.qc:29
nonvirtual void SetSliderFriction(float)
Sets the friction of the slider.
Definition PhysicsConstraint.qc:299
nonvirtual void SetConstraintType(constraint_t)
Will override the constraint type this entity represents.
Definition PhysicsConstraint.qc:253
nonvirtual void Break(entity)
Breaks the constraint.
Definition PhysicsConstraint.qc:198
virtual void Spawned(void)
Called when the entity is fulled initialized.
Definition PhysicsConstraint.qc:168
nonvirtual float GetConstraintSystemID(void)
Returns the unique joint group ID associated with a phys_constraintsystem.
Definition PhysicsConstraint.qc:149
nonvirtual float GetSliderStop(void)
Returns the maximum travel distance of the slider.
Definition PhysicsConstraint.qc:317
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition PhysicsConstraint.qc:70
nonvirtual float GetSliderMaxVelocity(void)
Returns the max velocity of a CONSTRAINT_SLIDER type ncPhysicsConstraint.
Definition PhysicsConstraint.qc:311
nonvirtual void WakeTargets(void)
Awakes the entities this constraint is connected to.
Definition PhysicsConstraint.qc:220
nonvirtual float GetSliderVelocity(void)
Returns the velocity of a CONSTRAINT_SLIDER type ncPhysicsConstraint.
Definition PhysicsConstraint.qc:305
nonvirtual void SetSliderMaxVelocity(float)
Sets the max velocity on a CONSTRAINT_SLIDER type ncPhysicsConstraint.
Definition PhysicsConstraint.qc:287
nonvirtual ncPhysicsConstraint Ballsocket(entity, entity, vector, vector, float, bool)
Creates a ballsocket constraint and returns it.
Definition PhysicsConstraint.qc:329
nonvirtual entity GetEntity2(void)
Returns the second entity connection.
Definition PhysicsConstraint.qc:247
nonvirtual void SetSliderStop(float)
Sets the maximum travel distance of the slider.
Definition PhysicsConstraint.qc:293
nonvirtual void SetEntity1(entity)
Sets the first entity in the connection.
Definition PhysicsConstraint.qc:259
nonvirtual void SetSliderVelocity(float)
Sets the velocity on a CONSTRAINT_SLIDER type ncPhysicsConstraint.
Definition PhysicsConstraint.qc:281
nonvirtual ncPhysicsConstraint Weld(entity, entity, float, float, float, bool, bool)
Creates a ballsocket constraint and returns it.
Definition PhysicsConstraint.qc:357
nonvirtual void ConstraintThink(void)
Definition PhysicsConstraint.qc:33
nonvirtual constraint_t GetConstraintType(void)
Returns the type of this constraint entity.
Definition PhysicsConstraint.qc:235
nonvirtual entity GetEntity1(void)
Returns the first entity connection.
Definition PhysicsConstraint.qc:241
virtual void OnRemoveEntity(void)
Handles what happens before the entity gets removed from the client game.
Definition PhysicsConstraint.qc:214
void ncPhysicsConstraint(void)
Definition PhysicsConstraint.qc:21
virtual void Input(entity, string, string)
Called when we are being prompted by another object/function with an input message.
Definition PhysicsConstraint.qc:180
virtual void Restore(string, string)
Similar to ncIO::SpawnKey() but for save-game fields.
Definition PhysicsConstraint.qc:83
nonvirtual float GetSliderFriction(void)
Returns the friction of the slider.
Definition PhysicsConstraint.qc:323
nonvirtual ncPhysicsConstraint Rope(entity, entity, vector, vector)
Creates a ballsocket constraint and returns it.
Definition PhysicsConstraint.qc:383
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition PhysicsConstraint.qc:114
nonvirtual void SetEntity2(entity)
Sets the second entity in the connection.
Definition PhysicsConstraint.qc:275
nonvirtual ncPhysicsConstraint KeepUpright(entity, vector, float)
Definition PhysicsConstraint.qc:412