Is there a python way of applying modifiers to objects real time-
ex. apply bend to cube in game engine when arrows are pressed.
Here is a code snippet to assign a modifier to tempObject so it will look at tempTrackObject.
# Add a TrackTo modifier to each object so it can look at another object.
myConstraint = tempObj.constraints.append(Constraint.Type.TRACKTO)
myConstraint[Constraint.Settings.TARGET] = tempTrackObj
myConstraint.__setitem__(Constraint.Settings.OWNERSPACE, Constraint.Settings.SPACE_LOCAL)
# For now only allow one orientation, the one that matches the default Anim settings values for new objects.
myConstraint.__setitem__(Constraint.Settings.TRACK, Constraint.Settings.TRACKY)
myConstraint.__setitem__(Constraint.Settings.UP, Constraint.Settings.UPZ)
I don’t know if it can be done in realtime with the bge, but I am doing it in a frame change event so it can be done on-the-fly.