Rotating component by positionMatrix doesn't work with physics entity

Hi all,

I’ve noted that using “rotateRelZ()” on the positionMatrix of a component doesn’t function when adding a physics entity. Simply removing the physics entity will make it function again.

See this simple example:
RotationTest.vcmx (237.1 KB)

Does anyone have a clue why and/or know how to automatically rotate a component with a physics entity?


Niels Visser

It looks like it’s because in In Physics mode, the object’s coordinates are refreshed in real time by the physical world so that the physical world can figure out in real time the real time position of the object when it is subjected to physical quantities, in this case the means of manually assigning a value to it doesn’t work successfully, so if that’s important to you I’d suggest changing it to:

def RotateComponentZAxis(component,angle):

  posMatrix = component.PositionMatrix
  phy.PhysicsType = 1
  for i in range (1,angle+1):
    component.PositionMatrix = posMatrix
  phy.PhysicsType = 0

This will apply to certain rotations that are not in the falling case.


Thank you! This will work for me :slight_smile:
Just for the details, to access the property and set it, use:

comp = getComponent()
phys = comp.findBehaviour(“PhysicsEntity”)

def getPhysicsTypeHandle():
for prop in phys.Properties:
if prop.Name == “Physics Type”:
return prop

physType = getPhysicsTypeHandle()

physType.Value = 1;