Source code for pyrcareworld.attributes.rigidbody_attr

import pyrcareworld.attributes as attr

[docs] class RigidbodyAttr(attr.ColliderAttr): """ Rigid body class. The data stored in self.data is a dictionary containing the following keys: - 'velocity': The velocity of the object. - 'angular_velocity': The angular velocity of the object. """
[docs] def SetMass(self, mass: float): """ Set the mass of this rigid body object. :param mass: Float, representing the mass of this rigid body. """ self._send_data("SetMass", float(mass))
[docs] def SetDrag(self, drag: float): """ Set the drag of this rigid body object. :param drag: Float, representing the drag of this rigid body. """ self._send_data("SetDrag", float(drag))
[docs] def SetAngularDrag(self, angular_drag: float): """ Set the angular drag of this rigid body object. :param angular_drag: Float, representing the angular drag of this rigid body. """ self._send_data("SetAngularDrag", float(angular_drag))
[docs] def SetUseGravity(self, use_gravity: bool): """ Set the rigid body to use gravity or not. :param use_gravity: Bool, use gravity or not. """ self._send_data("SetUseGravity", use_gravity)
[docs] def EnabledMouseDrag(self, enabled: bool): """ Enable or disable the rigid body Mouse Drag. :param enabled: Bool, enable Mouse Drag or not. """ self._send_data("EnabledMouseDrag", enabled)
[docs] def AddForce(self, force: list): """ Add force to this rigid body object. :param force: A list of length 3, representing the force added to this rigid body. """ if force is not None: force = [float(i) for i in force] self._send_data("AddForce", force)
[docs] def SetVelocity(self, velocity: list): """ Set the velocity of this rigid body object. :param velocity: A list of length 3, representing the velocity of this rigid body. """ if velocity is not None: velocity = [float(i) for i in velocity] self._send_data("SetVelocity", velocity)
[docs] def SetAngularVelocity(self, angular_velocity: list): """ Set the angular velocity of this rigid body object. :param angular_velocity: A list of length 3, representing the angular velocity of this rigid body. """ if angular_velocity is not None: angular_velocity = [float(i) for i in angular_velocity] self._send_data("SetAngularVelocity", angular_velocity)
[docs] def SetKinematic(self, is_kinematic: bool): """ Set the Rigidbody to be kinematic or not. :param is_kinematic: Bool, True if the Rigidbody is kinematic, False otherwise. """ self._send_data("SetKinematic", is_kinematic)