Munk2D Documentation  8.x.x
Loading...
Searching...
No Matches
cpConstraint.h
1/* Copyright (c) 2025 Victor Blomqvist
2 * Copyright (c) 2007-2024 Scott Lembcke and Howling Moon Software
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21*/
22
25
27typedef void (*cpConstraintPreSolveFunc)(cpConstraint *constraint, cpSpace *space);
29typedef void (*cpConstraintPostSolveFunc)(cpConstraint *constraint, cpSpace *space);
30
32CP_EXPORT void cpConstraintDestroy(cpConstraint *constraint);
34CP_EXPORT void cpConstraintFree(cpConstraint *constraint);
35
37CP_EXPORT cpSpace* cpConstraintGetSpace(const cpConstraint *constraint);
38
40CP_EXPORT cpBody* cpConstraintGetBodyA(const cpConstraint *constraint);
41
43CP_EXPORT cpBody* cpConstraintGetBodyB(const cpConstraint *constraint);
44
46CP_EXPORT cpFloat cpConstraintGetMaxForce(const cpConstraint *constraint);
48CP_EXPORT void cpConstraintSetMaxForce(cpConstraint *constraint, cpFloat maxForce);
49
51CP_EXPORT cpFloat cpConstraintGetErrorBias(const cpConstraint *constraint);
55CP_EXPORT void cpConstraintSetErrorBias(cpConstraint *constraint, cpFloat errorBias);
56
58CP_EXPORT cpFloat cpConstraintGetMaxBias(const cpConstraint *constraint);
60CP_EXPORT void cpConstraintSetMaxBias(cpConstraint *constraint, cpFloat maxBias);
61
65CP_EXPORT void cpConstraintSetCollideBodies(cpConstraint *constraint, cpBool collideBodies);
66
70CP_EXPORT void cpConstraintSetPreSolveFunc(cpConstraint *constraint, cpConstraintPreSolveFunc preSolveFunc);
71
75CP_EXPORT void cpConstraintSetPostSolveFunc(cpConstraint *constraint, cpConstraintPostSolveFunc postSolveFunc);
76
80CP_EXPORT void cpConstraintSetUserData(cpConstraint *constraint, cpDataPointer userData);
81
84
85#include "cpPinJoint.h"
86#include "cpSlideJoint.h"
87#include "cpPivotJoint.h"
88#include "cpGrooveJoint.h"
89#include "cpDampedSpring.h"
90#include "cpDampedRotarySpring.h"
91#include "cpRotaryLimitJoint.h"
92#include "cpRatchetJoint.h"
93#include "cpGearJoint.h"
94#include "cpSimpleMotor.h"
95
void * cpDataPointer
Type used for user data pointers.
Definition chipmunk_types.h:196
unsigned char cpBool
Chipmunk's boolean type.
Definition chipmunk_types.h:179
double cpFloat
Chipmunk's floating point type.
Definition chipmunk_types.h:68
CP_EXPORT void cpConstraintFree(cpConstraint *constraint)
Destroy and free a constraint.
CP_EXPORT cpSpace * cpConstraintGetSpace(const cpConstraint *constraint)
Get the cpSpace this constraint is added to.
CP_EXPORT void cpConstraintDestroy(cpConstraint *constraint)
Destroy a constraint.
void(* cpConstraintPostSolveFunc)(cpConstraint *constraint, cpSpace *space)
Callback function type that gets called after solving a joint.
Definition cpConstraint.h:29
CP_EXPORT void cpConstraintSetMaxBias(cpConstraint *constraint, cpFloat maxBias)
Set the maximum rate at which joint error is corrected. (defaults to INFINITY)
CP_EXPORT cpFloat cpConstraintGetMaxForce(const cpConstraint *constraint)
Get the maximum force that this constraint is allowed to use.
CP_EXPORT void cpConstraintSetPostSolveFunc(cpConstraint *constraint, cpConstraintPostSolveFunc postSolveFunc)
Set the post-solve function that is called before the solver runs.
CP_EXPORT void cpConstraintSetUserData(cpConstraint *constraint, cpDataPointer userData)
Set the user definable data pointer for this constraint.
CP_EXPORT void cpConstraintSetCollideBodies(cpConstraint *constraint, cpBool collideBodies)
Set if the two bodies connected by the constraint are allowed to collide or not. (defaults to cpFalse...
CP_EXPORT cpBody * cpConstraintGetBodyA(const cpConstraint *constraint)
Get the first body the constraint is attached to.
CP_EXPORT cpFloat cpConstraintGetMaxBias(const cpConstraint *constraint)
Get the maximum rate at which joint error is corrected.
CP_EXPORT cpFloat cpConstraintGetImpulse(cpConstraint *constraint)
Get the last impulse applied by this constraint.
CP_EXPORT cpConstraintPreSolveFunc cpConstraintGetPreSolveFunc(const cpConstraint *constraint)
Get the pre-solve function that is called before the solver runs.
CP_EXPORT cpBody * cpConstraintGetBodyB(const cpConstraint *constraint)
Get the second body the constraint is attached to.
CP_EXPORT cpBool cpConstraintGetCollideBodies(const cpConstraint *constraint)
Get if the two bodies connected by the constraint are allowed to collide or not.
CP_EXPORT cpConstraintPostSolveFunc cpConstraintGetPostSolveFunc(const cpConstraint *constraint)
Get the post-solve function that is called before the solver runs.
CP_EXPORT void cpConstraintSetPreSolveFunc(cpConstraint *constraint, cpConstraintPreSolveFunc preSolveFunc)
Set the pre-solve function that is called before the solver runs.
CP_EXPORT void cpConstraintSetErrorBias(cpConstraint *constraint, cpFloat errorBias)
Set rate at which joint error is corrected.
CP_EXPORT cpFloat cpConstraintGetErrorBias(const cpConstraint *constraint)
Get rate at which joint error is corrected.
void(* cpConstraintPreSolveFunc)(cpConstraint *constraint, cpSpace *space)
Callback function type that gets called before solving a joint.
Definition cpConstraint.h:27
CP_EXPORT cpDataPointer cpConstraintGetUserData(const cpConstraint *constraint)
Get the user definable data pointer for this constraint.
CP_EXPORT void cpConstraintSetMaxForce(cpConstraint *constraint, cpFloat maxForce)
Set the maximum force that this constraint is allowed to use. (defaults to INFINITY)
Definition chipmunk_structs.h:36
Definition chipmunk_structs.h:251
Definition chipmunk_structs.h:397