UPBGE / upbge

UPBGE, the best integrated game engine in Blender
https://upbge.org
Other
1.44k stars 180 forks source link

object.constraints #584

Open BluePrintRandom opened 7 years ago

BluePrintRandom commented 7 years ago

[idea] KX_GameObject.constraints

store a list of all active constraints in the game object that are affecting the game object

ie:vehicle wrapper or rigid body joint etc.

also

KX_GameObject.endConstraints()

could be handy*

Nemescraft commented 7 years ago

Good idea, but doesn't bge.constraints.removeConstraint(constraintId) already do the endConstraints() thing?

panzergame commented 7 years ago

@youle31, @DCubix, @lordloki : Do you agree with the following API proposed by BPR:

KX_GameObject.constraints --> return list of KX_ConstraintWrapper

I lean this proposition instead of something like bge.constraints.getConstraints(object) as the majority of the functions in bge.constraints are independent of an unique objects: adding a constraint depends of two objects, removing doesn't depend on any objects.

Also what to do with KX_VehicleWrapper, we should consider it as a constraint and add it into the list ?

Nemescraft commented 7 years ago

Vehicle Wrapper is just a bunch of constraints put together, isn't it?

panzergame commented 7 years ago

@Nemescraft : Internally Vehicle Wrapper isn't a constraint, for bullet it's an action which does it management of wheel and chassis position without the help of any other physics constraint. In the same type you have character wrapper which is also an action.