use super::*;
impl World {
pub fn set_motor_joint_linear_velocity(
&mut self,
joint_id: JointId,
velocity: impl Into<Vec3>,
) -> Result<()> {
callback_state::check_not_in_callback()?;
let velocity = velocity.into();
validation::vec3("motor_joint.linear_velocity", velocity)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe {
ffi::b3MotorJoint_SetLinearVelocity(joint_id.into_raw(), velocity.into_raw())
};
})
}
pub fn motor_joint_linear_velocity(&self, joint_id: JointId) -> Result<Vec3> {
family_method!(self, joint_id, JointType::Motor, {
Vec3::from_raw(unsafe { ffi::b3MotorJoint_GetLinearVelocity(joint_id.into_raw()) })
})
}
pub fn set_motor_joint_angular_velocity(
&mut self,
joint_id: JointId,
velocity: impl Into<Vec3>,
) -> Result<()> {
callback_state::check_not_in_callback()?;
let velocity = velocity.into();
validation::vec3("motor_joint.angular_velocity", velocity)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe {
ffi::b3MotorJoint_SetAngularVelocity(joint_id.into_raw(), velocity.into_raw())
};
})
}
pub fn motor_joint_angular_velocity(&self, joint_id: JointId) -> Result<Vec3> {
family_method!(self, joint_id, JointType::Motor, {
Vec3::from_raw(unsafe { ffi::b3MotorJoint_GetAngularVelocity(joint_id.into_raw()) })
})
}
pub fn set_motor_joint_max_velocity_force(
&mut self,
joint_id: JointId,
force: f32,
) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.max_velocity_force", force)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetMaxVelocityForce(joint_id.into_raw(), force) };
})
}
pub fn motor_joint_max_velocity_force(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetMaxVelocityForce(joint_id.into_raw()) }
})
}
pub fn set_motor_joint_max_velocity_torque(
&mut self,
joint_id: JointId,
torque: f32,
) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.max_velocity_torque", torque)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetMaxVelocityTorque(joint_id.into_raw(), torque) };
})
}
pub fn motor_joint_max_velocity_torque(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetMaxVelocityTorque(joint_id.into_raw()) }
})
}
pub fn set_motor_joint_linear_hertz(&mut self, joint_id: JointId, hertz: f32) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.linear_hertz", hertz)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetLinearHertz(joint_id.into_raw(), hertz) };
})
}
pub fn motor_joint_linear_hertz(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetLinearHertz(joint_id.into_raw()) }
})
}
pub fn set_motor_joint_linear_damping_ratio(
&mut self,
joint_id: JointId,
damping: f32,
) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.linear_damping_ratio", damping)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetLinearDampingRatio(joint_id.into_raw(), damping) };
})
}
pub fn motor_joint_linear_damping_ratio(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetLinearDampingRatio(joint_id.into_raw()) }
})
}
pub fn set_motor_joint_angular_hertz(&mut self, joint_id: JointId, hertz: f32) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.angular_hertz", hertz)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetAngularHertz(joint_id.into_raw(), hertz) };
})
}
pub fn motor_joint_angular_hertz(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetAngularHertz(joint_id.into_raw()) }
})
}
pub fn set_motor_joint_angular_damping_ratio(
&mut self,
joint_id: JointId,
damping: f32,
) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.angular_damping_ratio", damping)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetAngularDampingRatio(joint_id.into_raw(), damping) };
})
}
pub fn motor_joint_angular_damping_ratio(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetAngularDampingRatio(joint_id.into_raw()) }
})
}
pub fn set_motor_joint_max_spring_force(
&mut self,
joint_id: JointId,
force: f32,
) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.max_spring_force", force)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetMaxSpringForce(joint_id.into_raw(), force) };
})
}
pub fn motor_joint_max_spring_force(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetMaxSpringForce(joint_id.into_raw()) }
})
}
pub fn set_motor_joint_max_spring_torque(
&mut self,
joint_id: JointId,
torque: f32,
) -> Result<()> {
callback_state::check_not_in_callback()?;
validation::nonnegative("motor_joint.max_spring_torque", torque)?;
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_SetMaxSpringTorque(joint_id.into_raw(), torque) };
})
}
pub fn motor_joint_max_spring_torque(&self, joint_id: JointId) -> Result<f32> {
family_method!(self, joint_id, JointType::Motor, {
unsafe { ffi::b3MotorJoint_GetMaxSpringTorque(joint_id.into_raw()) }
})
}
}