-- Produced by boxnd-gen; edit the generator, not this file.

module Box3D.Body
  ( create
  , destroy
  , isValid
  , getType
  , setType
  , setName
  , getName
  , setUserData
  , getUserData
  , getPosition
  , getPositionInto
  , getRotation
  , getRotationInto
  , getTransform
  , getTransformInto
  , setTransform
  , getLocalPoint
  , getWorldPoint
  , getLocalVector
  , getWorldVector
  , getLinearVelocity
  , getLinearVelocityInto
  , getAngularVelocity
  , getAngularVelocityInto
  , setLinearVelocity
  , setAngularVelocity
  , setTargetTransform
  , getLocalPointVelocity
  , getWorldPointVelocity
  , applyForce
  , applyForceToCenter
  , applyTorque
  , applyLinearImpulse
  , applyLinearImpulseToCenter
  , applyAngularImpulse
  , getMass
  , getLocalRotationalInertia
  , getLocalRotationalInertiaInto
  , getInverseMass
  , getWorldInverseRotationalInertia
  , getWorldInverseRotationalInertiaInto
  , getLocalCenterOfMass
  , getLocalCenterOfMassInto
  , getWorldCenterOfMass
  , getWorldCenterOfMassInto
  , setMassData
  , getMassData
  , getMassDataInto
  , applyMassFromShapes
  , setLinearDamping
  , getLinearDamping
  , setAngularDamping
  , getAngularDamping
  , setGravityScale
  , getGravityScale
  , isAwake
  , setAwake
  , enableSleep
  , isSleepEnabled
  , setSleepThreshold
  , getSleepThreshold
  , isEnabled
  , disable
  , enable
  , setMotionLocks
  , getMotionLocks
  , getMotionLocksInto
  , setBullet
  , isBullet
  , enableContactRecycling
  , isContactRecyclingEnabled
  , enableHitEvents
  , getWorld
  , getShapeCount
  , getShapes
  , getJointCount
  , getJoints
  , getContactCapacity
  , getContactData
  , computeAABB
  , computeAABBInto
  , getClosestPoint
  , castRay
  , castShape
  , overlapShape
  , collideMover
  )

  where

import Foreign
import Foreign.C.Types (CBool(..), CInt(..))
import Foreign.C.String (CString)
import Data.Coerce (coerce)
import Box3D.Id (BodyId(..), JointId(..), ShapeId(..), WorldId(..))
import Box3D.MathTypes (AABB, Matrix3, Pos, Quat, Vec3, WorldTransform)
import Box3D.Tags (BodyCastResult, BodyPlaneResult, ContactData, ShapeProxy)
import Box3D.Types (BodyDef, BodyType(..), Capsule, MassData, MotionLocks, QueryFilter)

foreign import ccall unsafe "b3CreateBody"
  c_b3CreateBody :: WorldId -> Ptr BodyDef -> IO BodyId

foreign import ccall unsafe "b3DestroyBody"
  c_b3DestroyBody :: BodyId -> IO ()

foreign import ccall unsafe "b3Body_IsValid"
  c_b3Body_IsValid :: BodyId -> IO CBool

foreign import ccall unsafe "b3Body_GetType"
  c_b3Body_GetType :: BodyId -> IO CInt

foreign import ccall unsafe "b3Body_SetType"
  c_b3Body_SetType :: BodyId -> CInt -> IO ()

foreign import ccall unsafe "b3Body_SetName"
  c_b3Body_SetName :: BodyId -> CString -> IO ()

foreign import ccall unsafe "b3Body_GetName"
  c_b3Body_GetName :: BodyId -> IO CString

foreign import ccall unsafe "b3Body_SetUserData"
  c_b3Body_SetUserData :: BodyId -> Ptr () -> IO ()

foreign import ccall unsafe "b3Body_GetUserData"
  c_b3Body_GetUserData :: BodyId -> IO (Ptr ())

foreign import ccall unsafe "hsg_b3Body_GetPosition"
  c_b3Body_GetPosition :: BodyId -> Ptr Pos -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetRotation"
  c_b3Body_GetRotation :: BodyId -> Ptr Quat -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetTransform"
  c_b3Body_GetTransform :: BodyId -> Ptr WorldTransform -> IO ()

foreign import ccall unsafe "hsg_b3Body_SetTransform"
  c_b3Body_SetTransform :: BodyId -> Ptr Pos -> Ptr Quat -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetLocalPoint"
  c_b3Body_GetLocalPoint :: BodyId -> Ptr Pos -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetWorldPoint"
  c_b3Body_GetWorldPoint :: BodyId -> Ptr Vec3 -> Ptr Pos -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetLocalVector"
  c_b3Body_GetLocalVector :: BodyId -> Ptr Vec3 -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetWorldVector"
  c_b3Body_GetWorldVector :: BodyId -> Ptr Vec3 -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetLinearVelocity"
  c_b3Body_GetLinearVelocity :: BodyId -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetAngularVelocity"
  c_b3Body_GetAngularVelocity :: BodyId -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_SetLinearVelocity"
  c_b3Body_SetLinearVelocity :: BodyId -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_SetAngularVelocity"
  c_b3Body_SetAngularVelocity :: BodyId -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_SetTargetTransform"
  c_b3Body_SetTargetTransform :: BodyId -> Ptr WorldTransform -> Float -> CBool -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetLocalPointVelocity"
  c_b3Body_GetLocalPointVelocity :: BodyId -> Ptr Vec3 -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetWorldPointVelocity"
  c_b3Body_GetWorldPointVelocity :: BodyId -> Ptr Pos -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_ApplyForce"
  c_b3Body_ApplyForce :: BodyId -> Ptr Vec3 -> Ptr Pos -> CBool -> IO ()

foreign import ccall unsafe "hsg_b3Body_ApplyForceToCenter"
  c_b3Body_ApplyForceToCenter :: BodyId -> Ptr Vec3 -> CBool -> IO ()

foreign import ccall unsafe "hsg_b3Body_ApplyTorque"
  c_b3Body_ApplyTorque :: BodyId -> Ptr Vec3 -> CBool -> IO ()

foreign import ccall unsafe "hsg_b3Body_ApplyLinearImpulse"
  c_b3Body_ApplyLinearImpulse :: BodyId -> Ptr Vec3 -> Ptr Pos -> CBool -> IO ()

foreign import ccall unsafe "hsg_b3Body_ApplyLinearImpulseToCenter"
  c_b3Body_ApplyLinearImpulseToCenter :: BodyId -> Ptr Vec3 -> CBool -> IO ()

foreign import ccall unsafe "hsg_b3Body_ApplyAngularImpulse"
  c_b3Body_ApplyAngularImpulse :: BodyId -> Ptr Vec3 -> CBool -> IO ()

foreign import ccall unsafe "b3Body_GetMass"
  c_b3Body_GetMass :: BodyId -> IO Float

foreign import ccall unsafe "hsg_b3Body_GetLocalRotationalInertia"
  c_b3Body_GetLocalRotationalInertia :: BodyId -> Ptr Matrix3 -> IO ()

foreign import ccall unsafe "b3Body_GetInverseMass"
  c_b3Body_GetInverseMass :: BodyId -> IO Float

foreign import ccall unsafe "hsg_b3Body_GetWorldInverseRotationalInertia"
  c_b3Body_GetWorldInverseRotationalInertia :: BodyId -> Ptr Matrix3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetLocalCenterOfMass"
  c_b3Body_GetLocalCenterOfMass :: BodyId -> Ptr Vec3 -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetWorldCenterOfMass"
  c_b3Body_GetWorldCenterOfMass :: BodyId -> Ptr Pos -> IO ()

foreign import ccall unsafe "hsg_b3Body_SetMassData"
  c_b3Body_SetMassData :: BodyId -> Ptr MassData -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetMassData"
  c_b3Body_GetMassData :: BodyId -> Ptr MassData -> IO ()

foreign import ccall unsafe "b3Body_ApplyMassFromShapes"
  c_b3Body_ApplyMassFromShapes :: BodyId -> IO ()

foreign import ccall unsafe "b3Body_SetLinearDamping"
  c_b3Body_SetLinearDamping :: BodyId -> Float -> IO ()

foreign import ccall unsafe "b3Body_GetLinearDamping"
  c_b3Body_GetLinearDamping :: BodyId -> IO Float

foreign import ccall unsafe "b3Body_SetAngularDamping"
  c_b3Body_SetAngularDamping :: BodyId -> Float -> IO ()

foreign import ccall unsafe "b3Body_GetAngularDamping"
  c_b3Body_GetAngularDamping :: BodyId -> IO Float

foreign import ccall unsafe "b3Body_SetGravityScale"
  c_b3Body_SetGravityScale :: BodyId -> Float -> IO ()

foreign import ccall unsafe "b3Body_GetGravityScale"
  c_b3Body_GetGravityScale :: BodyId -> IO Float

foreign import ccall unsafe "b3Body_IsAwake"
  c_b3Body_IsAwake :: BodyId -> IO CBool

foreign import ccall unsafe "b3Body_SetAwake"
  c_b3Body_SetAwake :: BodyId -> CBool -> IO ()

foreign import ccall unsafe "b3Body_EnableSleep"
  c_b3Body_EnableSleep :: BodyId -> CBool -> IO ()

foreign import ccall unsafe "b3Body_IsSleepEnabled"
  c_b3Body_IsSleepEnabled :: BodyId -> IO CBool

foreign import ccall unsafe "b3Body_SetSleepThreshold"
  c_b3Body_SetSleepThreshold :: BodyId -> Float -> IO ()

foreign import ccall unsafe "b3Body_GetSleepThreshold"
  c_b3Body_GetSleepThreshold :: BodyId -> IO Float

foreign import ccall unsafe "b3Body_IsEnabled"
  c_b3Body_IsEnabled :: BodyId -> IO CBool

foreign import ccall unsafe "b3Body_Disable"
  c_b3Body_Disable :: BodyId -> IO ()

foreign import ccall unsafe "b3Body_Enable"
  c_b3Body_Enable :: BodyId -> IO ()

foreign import ccall unsafe "hsg_b3Body_SetMotionLocks"
  c_b3Body_SetMotionLocks :: BodyId -> Ptr MotionLocks -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetMotionLocks"
  c_b3Body_GetMotionLocks :: BodyId -> Ptr MotionLocks -> IO ()

foreign import ccall unsafe "b3Body_SetBullet"
  c_b3Body_SetBullet :: BodyId -> CBool -> IO ()

foreign import ccall unsafe "b3Body_IsBullet"
  c_b3Body_IsBullet :: BodyId -> IO CBool

foreign import ccall unsafe "b3Body_EnableContactRecycling"
  c_b3Body_EnableContactRecycling :: BodyId -> CBool -> IO ()

foreign import ccall unsafe "b3Body_IsContactRecyclingEnabled"
  c_b3Body_IsContactRecyclingEnabled :: BodyId -> IO CBool

foreign import ccall unsafe "b3Body_EnableHitEvents"
  c_b3Body_EnableHitEvents :: BodyId -> CBool -> IO ()

foreign import ccall unsafe "b3Body_GetWorld"
  c_b3Body_GetWorld :: BodyId -> IO WorldId

foreign import ccall unsafe "b3Body_GetShapeCount"
  c_b3Body_GetShapeCount :: BodyId -> IO CInt

foreign import ccall unsafe "b3Body_GetShapes"
  c_b3Body_GetShapes :: BodyId -> Ptr ShapeId -> CInt -> IO CInt

foreign import ccall unsafe "b3Body_GetJointCount"
  c_b3Body_GetJointCount :: BodyId -> IO CInt

foreign import ccall unsafe "b3Body_GetJoints"
  c_b3Body_GetJoints :: BodyId -> Ptr JointId -> CInt -> IO CInt

foreign import ccall unsafe "b3Body_GetContactCapacity"
  c_b3Body_GetContactCapacity :: BodyId -> IO CInt

foreign import ccall unsafe "b3Body_GetContactData"
  c_b3Body_GetContactData :: BodyId -> Ptr ContactData -> CInt -> IO CInt

foreign import ccall unsafe "hsg_b3Body_ComputeAABB"
  c_b3Body_ComputeAABB :: BodyId -> Ptr AABB -> IO ()

foreign import ccall unsafe "hsg_b3Body_GetClosestPoint"
  c_b3Body_GetClosestPoint :: BodyId -> Ptr Vec3 -> Ptr Vec3 -> IO Float

foreign import ccall unsafe "hsg_b3Body_CastRay"
  c_b3Body_CastRay :: BodyId -> Ptr Pos -> Ptr Vec3 -> Ptr QueryFilter -> Float -> Ptr WorldTransform -> Ptr BodyCastResult -> IO ()

foreign import ccall unsafe "hsg_b3Body_CastShape"
  c_b3Body_CastShape :: BodyId -> Ptr Pos -> Ptr ShapeProxy -> Ptr Vec3 -> Ptr QueryFilter -> Float -> CBool -> Ptr WorldTransform -> Ptr BodyCastResult -> IO ()

foreign import ccall unsafe "hsg_b3Body_OverlapShape"
  c_b3Body_OverlapShape :: BodyId -> Ptr Pos -> Ptr ShapeProxy -> Ptr QueryFilter -> Ptr WorldTransform -> IO CBool

foreign import ccall unsafe "hsg_b3Body_CollideMover"
  c_b3Body_CollideMover :: BodyId -> Ptr BodyPlaneResult -> CInt -> Ptr Pos -> Ptr Capsule -> Ptr QueryFilter -> Ptr WorldTransform -> IO CInt

{- | Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition
on the stack and pass it as a pointer.
b3BodyDef bodyDef = b3DefaultBodyDef();
b3BodyId myBodyId = b3CreateBody(myWorldId, &bodyDef);
Warning: This function is locked during callbacks.

Binds @b3CreateBody@.
-}
create
  :: WorldId
  -> BodyDef
  -> IO BodyId
create :: WorldId -> BodyDef -> IO BodyId
create WorldId
a0 BodyDef
a1 =
  BodyDef -> (Ptr BodyDef -> IO BodyId) -> IO BodyId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with BodyDef
a1 ((Ptr BodyDef -> IO BodyId) -> IO BodyId)
-> (Ptr BodyDef -> IO BodyId) -> IO BodyId
forall a b. (a -> b) -> a -> b
$ \Ptr BodyDef
p1 ->
  WorldId -> Ptr BodyDef -> IO BodyId
c_b3CreateBody WorldId
a0 Ptr BodyDef
p1

{- | Destroy a rigid body given an id. This destroys all shapes and joints attached to the body.
Do not keep references to the associated shapes and joints.

Binds @b3DestroyBody@.
-}
destroy
  :: BodyId
  -> IO ()
destroy :: BodyId -> IO ()
destroy BodyId
a0 =
  BodyId -> IO ()
c_b3DestroyBody BodyId
a0

{- | Body identifier validation. A valid body exists in a world and is non-null.
This can be used to detect orphaned ids. Provides validation for up to 64K allocations.

Binds @b3Body_IsValid@.
-}
isValid
  :: BodyId
  -> IO Bool
isValid :: BodyId -> IO Bool
isValid BodyId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CBool
c_b3Body_IsValid BodyId
a0)

{- | Get the body type: static, kinematic, or dynamic

Binds @b3Body_GetType@.
-}
getType
  :: BodyId
  -> IO BodyType
getType :: BodyId -> IO BodyType
getType BodyId
a0 =
  CInt -> BodyType
forall a b. Coercible a b => a -> b
coerce (CInt -> BodyType) -> IO CInt -> IO BodyType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CInt
c_b3Body_GetType BodyId
a0)

{- | Change the body type. This is an expensive operation. This automatically updates the mass
properties regardless of the automatic mass setting.

Binds @b3Body_SetType@.
-}
setType
  :: BodyId
  -> BodyType
  -> IO ()
setType :: BodyId -> BodyType -> IO ()
setType BodyId
a0 BodyType
a1 =
  BodyId -> CInt -> IO ()
c_b3Body_SetType BodyId
a0 (BodyType -> CInt
forall a b. Coercible a b => a -> b
coerce BodyType
a1)

{- | Set the body name. Up to B3_BODY_NAME_LENGTH characters including null termination.

Binds @b3Body_SetName@.
-}
setName
  :: BodyId
  -> CString
  -- ^ @name@
  -> IO ()
setName :: BodyId -> CString -> IO ()
setName BodyId
a0 CString
a1 =
  BodyId -> CString -> IO ()
c_b3Body_SetName BodyId
a0 CString
a1

{- | Get the body name.

Binds @b3Body_GetName@.
-}
getName
  :: BodyId
  -> IO CString
getName :: BodyId -> IO CString
getName BodyId
a0 =
  BodyId -> IO CString
c_b3Body_GetName BodyId
a0

{- | Set the user data for a body

Binds @b3Body_SetUserData@.
-}
setUserData
  :: BodyId
  -> Ptr ()
  -- ^ @userData@
  -> IO ()
setUserData :: BodyId -> Ptr () -> IO ()
setUserData BodyId
a0 Ptr ()
a1 =
  BodyId -> Ptr () -> IO ()
c_b3Body_SetUserData BodyId
a0 Ptr ()
a1

{- | Get the user data stored in a body

Binds @b3Body_GetUserData@.
-}
getUserData
  :: BodyId
  -> IO (Ptr ())
getUserData :: BodyId -> IO (Ptr ())
getUserData BodyId
a0 =
  BodyId -> IO (Ptr ())
c_b3Body_GetUserData BodyId
a0

{- | Get the world position of a body. This is the location of the body origin.

Binds @b3Body_GetPosition@.
-}
getPosition
  :: BodyId
  -> IO Pos
getPosition :: BodyId -> IO Pos
getPosition BodyId
a0 =
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> IO ()
c_b3Body_GetPosition BodyId
a0 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

-- | Like 'getPosition', but the result is written into a caller-supplied buffer.
getPositionInto
  :: BodyId
  -> Ptr Pos
  -- ^ Result buffer.
  -> IO ()
getPositionInto :: BodyId -> Ptr Pos -> IO ()
getPositionInto BodyId
a0 Ptr Pos
out =
  BodyId -> Ptr Pos -> IO ()
c_b3Body_GetPosition BodyId
a0 Ptr Pos
out

{- | Get the world rotation of a body as a quaternion

Binds @b3Body_GetRotation@.
-}
getRotation
  :: BodyId
  -> IO Quat
getRotation :: BodyId -> IO Quat
getRotation BodyId
a0 =
  (Ptr Quat -> IO Quat) -> IO Quat
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Quat -> IO Quat) -> IO Quat)
-> (Ptr Quat -> IO Quat) -> IO Quat
forall a b. (a -> b) -> a -> b
$ \Ptr Quat
pOut -> BodyId -> Ptr Quat -> IO ()
c_b3Body_GetRotation BodyId
a0 Ptr Quat
pOut IO () -> IO Quat -> IO Quat
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Quat -> IO Quat
forall a. Storable a => Ptr a -> IO a
peek Ptr Quat
pOut

-- | Like 'getRotation', but the result is written into a caller-supplied buffer.
getRotationInto
  :: BodyId
  -> Ptr Quat
  -- ^ Result buffer.
  -> IO ()
getRotationInto :: BodyId -> Ptr Quat -> IO ()
getRotationInto BodyId
a0 Ptr Quat
out =
  BodyId -> Ptr Quat -> IO ()
c_b3Body_GetRotation BodyId
a0 Ptr Quat
out

{- | Get the world transform of a body.

Binds @b3Body_GetTransform@.
-}
getTransform
  :: BodyId
  -> IO WorldTransform
getTransform :: BodyId -> IO WorldTransform
getTransform BodyId
a0 =
  (Ptr WorldTransform -> IO WorldTransform) -> IO WorldTransform
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr WorldTransform -> IO WorldTransform) -> IO WorldTransform)
-> (Ptr WorldTransform -> IO WorldTransform) -> IO WorldTransform
forall a b. (a -> b) -> a -> b
$ \Ptr WorldTransform
pOut -> BodyId -> Ptr WorldTransform -> IO ()
c_b3Body_GetTransform BodyId
a0 Ptr WorldTransform
pOut IO () -> IO WorldTransform -> IO WorldTransform
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr WorldTransform -> IO WorldTransform
forall a. Storable a => Ptr a -> IO a
peek Ptr WorldTransform
pOut

-- | Like 'getTransform', but the result is written into a caller-supplied buffer.
getTransformInto
  :: BodyId
  -> Ptr WorldTransform
  -- ^ Result buffer.
  -> IO ()
getTransformInto :: BodyId -> Ptr WorldTransform -> IO ()
getTransformInto BodyId
a0 Ptr WorldTransform
out =
  BodyId -> Ptr WorldTransform -> IO ()
c_b3Body_GetTransform BodyId
a0 Ptr WorldTransform
out

{- | Set the world transform of a body. This acts as a teleport and is fairly expensive.
Note: Generally you should create a body with the intended transform.
See also b3BodyDef::position and b3BodyDef::rotation.

Binds @b3Body_SetTransform@.
-}
setTransform
  :: BodyId
  -> Pos
  -- ^ @position@
  -> Quat
  -- ^ @rotation@
  -> IO ()
setTransform :: BodyId -> Pos -> Quat -> IO ()
setTransform BodyId
a0 Pos
a1 Quat
a2 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  Quat -> (Ptr Quat -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Quat
a2 ((Ptr Quat -> IO ()) -> IO ()) -> (Ptr Quat -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Quat
p2 ->
  BodyId -> Ptr Pos -> Ptr Quat -> IO ()
c_b3Body_SetTransform BodyId
a0 Ptr Pos
p1 Ptr Quat
p2

{- | Get a local point on a body given a world point

Binds @b3Body_GetLocalPoint@.
-}
getLocalPoint
  :: BodyId
  -> Pos
  -- ^ @worldPoint@
  -> IO Vec3
getLocalPoint :: BodyId -> Pos -> IO Pos
getLocalPoint BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> Ptr Pos -> IO ()
c_b3Body_GetLocalPoint BodyId
a0 Ptr Pos
p1 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

{- | Get a world point on a body given a local point

Binds @b3Body_GetWorldPoint@.
-}
getWorldPoint
  :: BodyId
  -> Vec3
  -- ^ @localPoint@
  -> IO Pos
getWorldPoint :: BodyId -> Pos -> IO Pos
getWorldPoint BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> Ptr Pos -> IO ()
c_b3Body_GetWorldPoint BodyId
a0 Ptr Pos
p1 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

{- | Get a local vector on a body given a world vector

Binds @b3Body_GetLocalVector@.
-}
getLocalVector
  :: BodyId
  -> Vec3
  -- ^ @worldVector@
  -> IO Vec3
getLocalVector :: BodyId -> Pos -> IO Pos
getLocalVector BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> Ptr Pos -> IO ()
c_b3Body_GetLocalVector BodyId
a0 Ptr Pos
p1 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

{- | Get a world vector on a body given a local vector

Binds @b3Body_GetWorldVector@.
-}
getWorldVector
  :: BodyId
  -> Vec3
  -- ^ @localVector@
  -> IO Vec3
getWorldVector :: BodyId -> Pos -> IO Pos
getWorldVector BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> Ptr Pos -> IO ()
c_b3Body_GetWorldVector BodyId
a0 Ptr Pos
p1 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

{- | Get the linear velocity of a body\'s center of mass. Usually in meters per second.

Binds @b3Body_GetLinearVelocity@.
-}
getLinearVelocity
  :: BodyId
  -> IO Vec3
getLinearVelocity :: BodyId -> IO Pos
getLinearVelocity BodyId
a0 =
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> IO ()
c_b3Body_GetLinearVelocity BodyId
a0 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

-- | Like 'getLinearVelocity', but the result is written into a caller-supplied buffer.
getLinearVelocityInto
  :: BodyId
  -> Ptr Vec3
  -- ^ Result buffer.
  -> IO ()
getLinearVelocityInto :: BodyId -> Ptr Pos -> IO ()
getLinearVelocityInto BodyId
a0 Ptr Pos
out =
  BodyId -> Ptr Pos -> IO ()
c_b3Body_GetLinearVelocity BodyId
a0 Ptr Pos
out

{- | Get the angular velocity of a body in radians per second

Binds @b3Body_GetAngularVelocity@.
-}
getAngularVelocity
  :: BodyId
  -> IO Vec3
getAngularVelocity :: BodyId -> IO Pos
getAngularVelocity BodyId
a0 =
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> IO ()
c_b3Body_GetAngularVelocity BodyId
a0 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

-- | Like 'getAngularVelocity', but the result is written into a caller-supplied buffer.
getAngularVelocityInto
  :: BodyId
  -> Ptr Vec3
  -- ^ Result buffer.
  -> IO ()
getAngularVelocityInto :: BodyId -> Ptr Pos -> IO ()
getAngularVelocityInto BodyId
a0 Ptr Pos
out =
  BodyId -> Ptr Pos -> IO ()
c_b3Body_GetAngularVelocity BodyId
a0 Ptr Pos
out

{- | Set the linear velocity of a body. Usually in meters per second.

Binds @b3Body_SetLinearVelocity@.
-}
setLinearVelocity
  :: BodyId
  -> Vec3
  -- ^ @linearVelocity@
  -> IO ()
setLinearVelocity :: BodyId -> Pos -> IO ()
setLinearVelocity BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  BodyId -> Ptr Pos -> IO ()
c_b3Body_SetLinearVelocity BodyId
a0 Ptr Pos
p1

{- | Set the angular velocity of a body in radians per second

Binds @b3Body_SetAngularVelocity@.
-}
setAngularVelocity
  :: BodyId
  -> Vec3
  -- ^ @angularVelocity@
  -> IO ()
setAngularVelocity :: BodyId -> Pos -> IO ()
setAngularVelocity BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  BodyId -> Ptr Pos -> IO ()
c_b3Body_SetAngularVelocity BodyId
a0 Ptr Pos
p1

{- | Set the velocity to reach the given transform after a given time step.
The result will be close but maybe not exact. This is meant for kinematic bodies.
The target is not applied if the velocity would be below the sleep threshold.
This will optionally wake the body if asleep, but only if the movement is significant.

Binds @b3Body_SetTargetTransform@.
-}
setTargetTransform
  :: BodyId
  -> WorldTransform
  -- ^ @target@
  -> Float
  -- ^ @timeStep@
  -> Bool
  -- ^ @wake@
  -> IO ()
setTargetTransform :: BodyId -> WorldTransform -> Float -> Bool -> IO ()
setTargetTransform BodyId
a0 WorldTransform
a1 Float
a2 Bool
a3 =
  WorldTransform -> (Ptr WorldTransform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with WorldTransform
a1 ((Ptr WorldTransform -> IO ()) -> IO ())
-> (Ptr WorldTransform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr WorldTransform
p1 ->
  BodyId -> Ptr WorldTransform -> Float -> CBool -> IO ()
c_b3Body_SetTargetTransform BodyId
a0 Ptr WorldTransform
p1 Float
a2 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a3)

{- | Get the linear velocity of a local point attached to a body. Usually in meters per second.

Binds @b3Body_GetLocalPointVelocity@.
-}
getLocalPointVelocity
  :: BodyId
  -> Vec3
  -- ^ @localPoint@
  -> IO Vec3
getLocalPointVelocity :: BodyId -> Pos -> IO Pos
getLocalPointVelocity BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> Ptr Pos -> IO ()
c_b3Body_GetLocalPointVelocity BodyId
a0 Ptr Pos
p1 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

{- | Get the linear velocity of a world point attached to a body. Usually in meters per second.

Binds @b3Body_GetWorldPointVelocity@.
-}
getWorldPointVelocity
  :: BodyId
  -> Pos
  -- ^ @worldPoint@
  -> IO Vec3
getWorldPointVelocity :: BodyId -> Pos -> IO Pos
getWorldPointVelocity BodyId
a0 Pos
a1 =
  Pos -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> Ptr Pos -> IO ()
c_b3Body_GetWorldPointVelocity BodyId
a0 Ptr Pos
p1 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

{- | Apply a force at a world point. If the force is not applied at the center of mass,
it will generate a torque and affect the angular velocity. This optionally wakes up the body.
The force is ignored if the body is not awake.

Binds @b3Body_ApplyForce@.
-}
applyForce
  :: BodyId
  -- ^ @bodyId@: The body id
  -> Vec3
  -- ^ @force@: The world force vector, usually in newtons (N)
  -> Pos
  -- ^ @point@: The world position of the point of application
  -> Bool
  -- ^ @wake@: Option to wake up the body
  -> IO ()
applyForce :: BodyId -> Pos -> Pos -> Bool -> IO ()
applyForce BodyId
a0 Pos
a1 Pos
a2 Bool
a3 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a2 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p2 ->
  BodyId -> Ptr Pos -> Ptr Pos -> CBool -> IO ()
c_b3Body_ApplyForce BodyId
a0 Ptr Pos
p1 Ptr Pos
p2 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a3)

{- | Apply a force to the center of mass. This optionally wakes up the body.
The force is ignored if the body is not awake.

Binds @b3Body_ApplyForceToCenter@.
-}
applyForceToCenter
  :: BodyId
  -- ^ @bodyId@: The body id
  -> Vec3
  -- ^ @force@: the world force vector, usually in newtons (N).
  -> Bool
  -- ^ @wake@: also wake up the body
  -> IO ()
applyForceToCenter :: BodyId -> Pos -> Bool -> IO ()
applyForceToCenter BodyId
a0 Pos
a1 Bool
a2 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  BodyId -> Ptr Pos -> CBool -> IO ()
c_b3Body_ApplyForceToCenter BodyId
a0 Ptr Pos
p1 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a2)

{- | Apply a torque. This affects the angular velocity without affecting the linear velocity.
This optionally wakes the body. The torque is ignored if the body is not awake.

Binds @b3Body_ApplyTorque@.
-}
applyTorque
  :: BodyId
  -- ^ @bodyId@: The body id
  -> Vec3
  -- ^ @torque@: the world torque vector, usually in N*m.
  -> Bool
  -- ^ @wake@: also wake up the body
  -> IO ()
applyTorque :: BodyId -> Pos -> Bool -> IO ()
applyTorque BodyId
a0 Pos
a1 Bool
a2 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  BodyId -> Ptr Pos -> CBool -> IO ()
c_b3Body_ApplyTorque BodyId
a0 Ptr Pos
p1 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a2)

{- | Apply an impulse at a point. This immediately modifies the velocity.
It also modifies the angular velocity if the point of application
is not at the center of mass. This optionally wakes the body.
The impulse is ignored if the body is not awake.
Warning: This should be used for one-shot impulses. If you need a steady force,
use a force instead, which will work better with the sub-stepping solver.

Binds @b3Body_ApplyLinearImpulse@.
-}
applyLinearImpulse
  :: BodyId
  -- ^ @bodyId@: The body id
  -> Vec3
  -- ^ @impulse@: the world impulse vector, usually in N*s or kg*m\/s.
  -> Pos
  -- ^ @point@: the world position of the point of application.
  -> Bool
  -- ^ @wake@: also wake up the body
  -> IO ()
applyLinearImpulse :: BodyId -> Pos -> Pos -> Bool -> IO ()
applyLinearImpulse BodyId
a0 Pos
a1 Pos
a2 Bool
a3 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a2 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p2 ->
  BodyId -> Ptr Pos -> Ptr Pos -> CBool -> IO ()
c_b3Body_ApplyLinearImpulse BodyId
a0 Ptr Pos
p1 Ptr Pos
p2 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a3)

{- | Apply an impulse to the center of mass. This immediately modifies the velocity.
The impulse is ignored if the body is not awake. This optionally wakes the body.
Warning: This should be used for one-shot impulses. If you need a steady force,
use a force instead, which will work better with the sub-stepping solver.

Binds @b3Body_ApplyLinearImpulseToCenter@.
-}
applyLinearImpulseToCenter
  :: BodyId
  -- ^ @bodyId@: The body id
  -> Vec3
  -- ^ @impulse@: the world impulse vector, usually in N*s or kg*m\/s.
  -> Bool
  -- ^ @wake@: also wake up the body
  -> IO ()
applyLinearImpulseToCenter :: BodyId -> Pos -> Bool -> IO ()
applyLinearImpulseToCenter BodyId
a0 Pos
a1 Bool
a2 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  BodyId -> Ptr Pos -> CBool -> IO ()
c_b3Body_ApplyLinearImpulseToCenter BodyId
a0 Ptr Pos
p1 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a2)

{- | Apply an angular impulse in world space. The impulse is ignored if the body is not awake.
This optionally wakes the body.
Warning: This should be used for one-shot impulses. If you need a steady torque,
use a torque instead, which will work better with the sub-stepping solver.

Binds @b3Body_ApplyAngularImpulse@.
-}
applyAngularImpulse
  :: BodyId
  -- ^ @bodyId@: The body id
  -> Vec3
  -- ^ @impulse@: the world angular impulse vector, usually in units of kg*m*m\/s
  -> Bool
  -- ^ @wake@: also wake up the body
  -> IO ()
applyAngularImpulse :: BodyId -> Pos -> Bool -> IO ()
applyAngularImpulse BodyId
a0 Pos
a1 Bool
a2 =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  BodyId -> Ptr Pos -> CBool -> IO ()
c_b3Body_ApplyAngularImpulse BodyId
a0 Ptr Pos
p1 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a2)

{- | Get the mass of the body, usually in kilograms

Binds @b3Body_GetMass@.
-}
getMass
  :: BodyId
  -> IO Float
getMass :: BodyId -> IO Float
getMass BodyId
a0 =
  BodyId -> IO Float
c_b3Body_GetMass BodyId
a0

{- | Get the rotational inertia of the body in local space, usually in kg*m^2

Binds @b3Body_GetLocalRotationalInertia@.
-}
getLocalRotationalInertia
  :: BodyId
  -> IO Matrix3
getLocalRotationalInertia :: BodyId -> IO Matrix3
getLocalRotationalInertia BodyId
a0 =
  (Ptr Matrix3 -> IO Matrix3) -> IO Matrix3
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Matrix3 -> IO Matrix3) -> IO Matrix3)
-> (Ptr Matrix3 -> IO Matrix3) -> IO Matrix3
forall a b. (a -> b) -> a -> b
$ \Ptr Matrix3
pOut -> BodyId -> Ptr Matrix3 -> IO ()
c_b3Body_GetLocalRotationalInertia BodyId
a0 Ptr Matrix3
pOut IO () -> IO Matrix3 -> IO Matrix3
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Matrix3 -> IO Matrix3
forall a. Storable a => Ptr a -> IO a
peek Ptr Matrix3
pOut

-- | Like 'getLocalRotationalInertia', but the result is written into a caller-supplied buffer.
getLocalRotationalInertiaInto
  :: BodyId
  -> Ptr Matrix3
  -- ^ Result buffer.
  -> IO ()
getLocalRotationalInertiaInto :: BodyId -> Ptr Matrix3 -> IO ()
getLocalRotationalInertiaInto BodyId
a0 Ptr Matrix3
out =
  BodyId -> Ptr Matrix3 -> IO ()
c_b3Body_GetLocalRotationalInertia BodyId
a0 Ptr Matrix3
out

{- | Get the inverse mass of the body, usually in 1\/kilograms

Binds @b3Body_GetInverseMass@.
-}
getInverseMass
  :: BodyId
  -> IO Float
getInverseMass :: BodyId -> IO Float
getInverseMass BodyId
a0 =
  BodyId -> IO Float
c_b3Body_GetInverseMass BodyId
a0

{- | Get the inverse rotational inertia of the body in world space, usually in 1\/kg*m^2

Binds @b3Body_GetWorldInverseRotationalInertia@.
-}
getWorldInverseRotationalInertia
  :: BodyId
  -> IO Matrix3
getWorldInverseRotationalInertia :: BodyId -> IO Matrix3
getWorldInverseRotationalInertia BodyId
a0 =
  (Ptr Matrix3 -> IO Matrix3) -> IO Matrix3
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Matrix3 -> IO Matrix3) -> IO Matrix3)
-> (Ptr Matrix3 -> IO Matrix3) -> IO Matrix3
forall a b. (a -> b) -> a -> b
$ \Ptr Matrix3
pOut -> BodyId -> Ptr Matrix3 -> IO ()
c_b3Body_GetWorldInverseRotationalInertia BodyId
a0 Ptr Matrix3
pOut IO () -> IO Matrix3 -> IO Matrix3
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Matrix3 -> IO Matrix3
forall a. Storable a => Ptr a -> IO a
peek Ptr Matrix3
pOut

-- | Like 'getWorldInverseRotationalInertia', but the result is written into a caller-supplied buffer.
getWorldInverseRotationalInertiaInto
  :: BodyId
  -> Ptr Matrix3
  -- ^ Result buffer.
  -> IO ()
getWorldInverseRotationalInertiaInto :: BodyId -> Ptr Matrix3 -> IO ()
getWorldInverseRotationalInertiaInto BodyId
a0 Ptr Matrix3
out =
  BodyId -> Ptr Matrix3 -> IO ()
c_b3Body_GetWorldInverseRotationalInertia BodyId
a0 Ptr Matrix3
out

{- | Get the center of mass position of the body in local space

Binds @b3Body_GetLocalCenterOfMass@.
-}
getLocalCenterOfMass
  :: BodyId
  -> IO Vec3
getLocalCenterOfMass :: BodyId -> IO Pos
getLocalCenterOfMass BodyId
a0 =
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> IO ()
c_b3Body_GetLocalCenterOfMass BodyId
a0 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

-- | Like 'getLocalCenterOfMass', but the result is written into a caller-supplied buffer.
getLocalCenterOfMassInto
  :: BodyId
  -> Ptr Vec3
  -- ^ Result buffer.
  -> IO ()
getLocalCenterOfMassInto :: BodyId -> Ptr Pos -> IO ()
getLocalCenterOfMassInto BodyId
a0 Ptr Pos
out =
  BodyId -> Ptr Pos -> IO ()
c_b3Body_GetLocalCenterOfMass BodyId
a0 Ptr Pos
out

{- | Get the center of mass position of the body in world space

Binds @b3Body_GetWorldCenterOfMass@.
-}
getWorldCenterOfMass
  :: BodyId
  -> IO Pos
getWorldCenterOfMass :: BodyId -> IO Pos
getWorldCenterOfMass BodyId
a0 =
  (Ptr Pos -> IO Pos) -> IO Pos
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Pos -> IO Pos) -> IO Pos) -> (Ptr Pos -> IO Pos) -> IO Pos
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
pOut -> BodyId -> Ptr Pos -> IO ()
c_b3Body_GetWorldCenterOfMass BodyId
a0 Ptr Pos
pOut IO () -> IO Pos -> IO Pos
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Pos -> IO Pos
forall a. Storable a => Ptr a -> IO a
peek Ptr Pos
pOut

-- | Like 'getWorldCenterOfMass', but the result is written into a caller-supplied buffer.
getWorldCenterOfMassInto
  :: BodyId
  -> Ptr Pos
  -- ^ Result buffer.
  -> IO ()
getWorldCenterOfMassInto :: BodyId -> Ptr Pos -> IO ()
getWorldCenterOfMassInto BodyId
a0 Ptr Pos
out =
  BodyId -> Ptr Pos -> IO ()
c_b3Body_GetWorldCenterOfMass BodyId
a0 Ptr Pos
out

{- | Override the body\'s mass properties. Normally this is computed automatically using the
shape geometry and density. This information is lost if a shape is added or removed or if the
body type changes.

Binds @b3Body_SetMassData@.
-}
setMassData
  :: BodyId
  -> MassData
  -> IO ()
setMassData :: BodyId -> MassData -> IO ()
setMassData BodyId
a0 MassData
a1 =
  MassData -> (Ptr MassData -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with MassData
a1 ((Ptr MassData -> IO ()) -> IO ())
-> (Ptr MassData -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr MassData
p1 ->
  BodyId -> Ptr MassData -> IO ()
c_b3Body_SetMassData BodyId
a0 Ptr MassData
p1

{- | Get the mass data for a body

Binds @b3Body_GetMassData@.
-}
getMassData
  :: BodyId
  -> IO MassData
getMassData :: BodyId -> IO MassData
getMassData BodyId
a0 =
  (Ptr MassData -> IO MassData) -> IO MassData
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr MassData -> IO MassData) -> IO MassData)
-> (Ptr MassData -> IO MassData) -> IO MassData
forall a b. (a -> b) -> a -> b
$ \Ptr MassData
pOut -> BodyId -> Ptr MassData -> IO ()
c_b3Body_GetMassData BodyId
a0 Ptr MassData
pOut IO () -> IO MassData -> IO MassData
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr MassData -> IO MassData
forall a. Storable a => Ptr a -> IO a
peek Ptr MassData
pOut

-- | Like 'getMassData', but the result is written into a caller-supplied buffer.
getMassDataInto
  :: BodyId
  -> Ptr MassData
  -- ^ Result buffer.
  -> IO ()
getMassDataInto :: BodyId -> Ptr MassData -> IO ()
getMassDataInto BodyId
a0 Ptr MassData
out =
  BodyId -> Ptr MassData -> IO ()
c_b3Body_GetMassData BodyId
a0 Ptr MassData
out

{- | This updates the mass properties to the sum of the mass properties of the shapes.
This normally does not need to be called unless you called SetMassData to override
the mass and you later want to reset the mass.
You may also use this when automatic mass computation has been disabled.
You should call this regardless of body type.

Binds @b3Body_ApplyMassFromShapes@.
-}
applyMassFromShapes
  :: BodyId
  -> IO ()
applyMassFromShapes :: BodyId -> IO ()
applyMassFromShapes BodyId
a0 =
  BodyId -> IO ()
c_b3Body_ApplyMassFromShapes BodyId
a0

{- | Adjust the linear damping. Normally this is set in b3BodyDef before creation.

Binds @b3Body_SetLinearDamping@.
-}
setLinearDamping
  :: BodyId
  -> Float
  -- ^ @linearDamping@
  -> IO ()
setLinearDamping :: BodyId -> Float -> IO ()
setLinearDamping BodyId
a0 Float
a1 =
  BodyId -> Float -> IO ()
c_b3Body_SetLinearDamping BodyId
a0 Float
a1

{- | Get the current linear damping.

Binds @b3Body_GetLinearDamping@.
-}
getLinearDamping
  :: BodyId
  -> IO Float
getLinearDamping :: BodyId -> IO Float
getLinearDamping BodyId
a0 =
  BodyId -> IO Float
c_b3Body_GetLinearDamping BodyId
a0

{- | Adjust the angular damping. Normally this is set in b3BodyDef before creation.

Binds @b3Body_SetAngularDamping@.
-}
setAngularDamping
  :: BodyId
  -> Float
  -- ^ @angularDamping@
  -> IO ()
setAngularDamping :: BodyId -> Float -> IO ()
setAngularDamping BodyId
a0 Float
a1 =
  BodyId -> Float -> IO ()
c_b3Body_SetAngularDamping BodyId
a0 Float
a1

{- | Get the current angular damping.

Binds @b3Body_GetAngularDamping@.
-}
getAngularDamping
  :: BodyId
  -> IO Float
getAngularDamping :: BodyId -> IO Float
getAngularDamping BodyId
a0 =
  BodyId -> IO Float
c_b3Body_GetAngularDamping BodyId
a0

{- | Adjust the gravity scale. Normally this is set in b3BodyDef before creation.
See also b3BodyDef::gravityScale.

Binds @b3Body_SetGravityScale@.
-}
setGravityScale
  :: BodyId
  -> Float
  -- ^ @gravityScale@
  -> IO ()
setGravityScale :: BodyId -> Float -> IO ()
setGravityScale BodyId
a0 Float
a1 =
  BodyId -> Float -> IO ()
c_b3Body_SetGravityScale BodyId
a0 Float
a1

{- | Get the current gravity scale

Binds @b3Body_GetGravityScale@.
-}
getGravityScale
  :: BodyId
  -> IO Float
getGravityScale :: BodyId -> IO Float
getGravityScale BodyId
a0 =
  BodyId -> IO Float
c_b3Body_GetGravityScale BodyId
a0

{- | Returns: true if this body is awake

Binds @b3Body_IsAwake@.
-}
isAwake
  :: BodyId
  -> IO Bool
isAwake :: BodyId -> IO Bool
isAwake BodyId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CBool
c_b3Body_IsAwake BodyId
a0)

{- | Wake a body from sleep. This wakes the entire island the body is touching.
Warning: Putting a body to sleep will put the entire island of bodies touching this body to sleep,
which can be expensive and possibly unintuitive.

Binds @b3Body_SetAwake@.
-}
setAwake
  :: BodyId
  -> Bool
  -- ^ @awake@
  -> IO ()
setAwake :: BodyId -> Bool -> IO ()
setAwake BodyId
a0 Bool
a1 =
  BodyId -> CBool -> IO ()
c_b3Body_SetAwake BodyId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Enable or disable sleeping for this body. If sleeping is disabled the body will wake.

Binds @b3Body_EnableSleep@.
-}
enableSleep
  :: BodyId
  -> Bool
  -- ^ @enableSleep@
  -> IO ()
enableSleep :: BodyId -> Bool -> IO ()
enableSleep BodyId
a0 Bool
a1 =
  BodyId -> CBool -> IO ()
c_b3Body_EnableSleep BodyId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Returns true if sleeping is enabled for this body

Binds @b3Body_IsSleepEnabled@.
-}
isSleepEnabled
  :: BodyId
  -> IO Bool
isSleepEnabled :: BodyId -> IO Bool
isSleepEnabled BodyId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CBool
c_b3Body_IsSleepEnabled BodyId
a0)

{- | Set the sleep threshold, usually in meters per second

Binds @b3Body_SetSleepThreshold@.
-}
setSleepThreshold
  :: BodyId
  -> Float
  -- ^ @sleepThreshold@
  -> IO ()
setSleepThreshold :: BodyId -> Float -> IO ()
setSleepThreshold BodyId
a0 Float
a1 =
  BodyId -> Float -> IO ()
c_b3Body_SetSleepThreshold BodyId
a0 Float
a1

{- | Get the sleep threshold, usually in meters per second.

Binds @b3Body_GetSleepThreshold@.
-}
getSleepThreshold
  :: BodyId
  -> IO Float
getSleepThreshold :: BodyId -> IO Float
getSleepThreshold BodyId
a0 =
  BodyId -> IO Float
c_b3Body_GetSleepThreshold BodyId
a0

{- | Returns true if this body is enabled

Binds @b3Body_IsEnabled@.
-}
isEnabled
  :: BodyId
  -> IO Bool
isEnabled :: BodyId -> IO Bool
isEnabled BodyId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CBool
c_b3Body_IsEnabled BodyId
a0)

{- | Disable a body by removing it completely from the simulation. This is expensive.

Binds @b3Body_Disable@.
-}
disable
  :: BodyId
  -> IO ()
disable :: BodyId -> IO ()
disable BodyId
a0 =
  BodyId -> IO ()
c_b3Body_Disable BodyId
a0

{- | Enable a body by adding it to the simulation. This is expensive.

Binds @b3Body_Enable@.
-}
enable
  :: BodyId
  -> IO ()
enable :: BodyId -> IO ()
enable BodyId
a0 =
  BodyId -> IO ()
c_b3Body_Enable BodyId
a0

{- | Set the motion locks on this body.

Binds @b3Body_SetMotionLocks@.
-}
setMotionLocks
  :: BodyId
  -> MotionLocks
  -> IO ()
setMotionLocks :: BodyId -> MotionLocks -> IO ()
setMotionLocks BodyId
a0 MotionLocks
a1 =
  MotionLocks -> (Ptr MotionLocks -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with MotionLocks
a1 ((Ptr MotionLocks -> IO ()) -> IO ())
-> (Ptr MotionLocks -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr MotionLocks
p1 ->
  BodyId -> Ptr MotionLocks -> IO ()
c_b3Body_SetMotionLocks BodyId
a0 Ptr MotionLocks
p1

{- | Get the motion locks for this body.

Binds @b3Body_GetMotionLocks@.
-}
getMotionLocks
  :: BodyId
  -> IO MotionLocks
getMotionLocks :: BodyId -> IO MotionLocks
getMotionLocks BodyId
a0 =
  (Ptr MotionLocks -> IO MotionLocks) -> IO MotionLocks
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr MotionLocks -> IO MotionLocks) -> IO MotionLocks)
-> (Ptr MotionLocks -> IO MotionLocks) -> IO MotionLocks
forall a b. (a -> b) -> a -> b
$ \Ptr MotionLocks
pOut -> BodyId -> Ptr MotionLocks -> IO ()
c_b3Body_GetMotionLocks BodyId
a0 Ptr MotionLocks
pOut IO () -> IO MotionLocks -> IO MotionLocks
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr MotionLocks -> IO MotionLocks
forall a. Storable a => Ptr a -> IO a
peek Ptr MotionLocks
pOut

-- | Like 'getMotionLocks', but the result is written into a caller-supplied buffer.
getMotionLocksInto
  :: BodyId
  -> Ptr MotionLocks
  -- ^ Result buffer.
  -> IO ()
getMotionLocksInto :: BodyId -> Ptr MotionLocks -> IO ()
getMotionLocksInto BodyId
a0 Ptr MotionLocks
out =
  BodyId -> Ptr MotionLocks -> IO ()
c_b3Body_GetMotionLocks BodyId
a0 Ptr MotionLocks
out

{- | Set this body to be a bullet. A bullet does continuous collision detection
against dynamic bodies (but not other bullets).

Binds @b3Body_SetBullet@.
-}
setBullet
  :: BodyId
  -> Bool
  -- ^ @flag@
  -> IO ()
setBullet :: BodyId -> Bool -> IO ()
setBullet BodyId
a0 Bool
a1 =
  BodyId -> CBool -> IO ()
c_b3Body_SetBullet BodyId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Is this body a bullet?

Binds @b3Body_IsBullet@.
-}
isBullet
  :: BodyId
  -> IO Bool
isBullet :: BodyId -> IO Bool
isBullet BodyId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CBool
c_b3Body_IsBullet BodyId
a0)

{- | Enable or disable contact recycling for this body. Contact recycling is a performance optimization
that reuses contact manifolds when bodies move slightly. Disabling it can avoid ghost collisions
on characters at the cost of higher per-step work. Existing contacts retain their prior setting;
only contacts created after this call see the new value.
See also b3BodyDef::enableContactRecycling.

Binds @b3Body_EnableContactRecycling@.
-}
enableContactRecycling
  :: BodyId
  -> Bool
  -- ^ @flag@
  -> IO ()
enableContactRecycling :: BodyId -> Bool -> IO ()
enableContactRecycling BodyId
a0 Bool
a1 =
  BodyId -> CBool -> IO ()
c_b3Body_EnableContactRecycling BodyId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Is contact recycling enabled on this body?

Binds @b3Body_IsContactRecyclingEnabled@.
-}
isContactRecyclingEnabled
  :: BodyId
  -> IO Bool
isContactRecyclingEnabled :: BodyId -> IO Bool
isContactRecyclingEnabled BodyId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CBool
c_b3Body_IsContactRecyclingEnabled BodyId
a0)

{- | Enable\/disable hit events on all shapes
See also b3ShapeDef::enableHitEvents.

Binds @b3Body_EnableHitEvents@.
-}
enableHitEvents
  :: BodyId
  -> Bool
  -- ^ @enableHitEvents@
  -> IO ()
enableHitEvents :: BodyId -> Bool -> IO ()
enableHitEvents BodyId
a0 Bool
a1 =
  BodyId -> CBool -> IO ()
c_b3Body_EnableHitEvents BodyId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Get the world that owns this body

Binds @b3Body_GetWorld@.
-}
getWorld
  :: BodyId
  -> IO WorldId
getWorld :: BodyId -> IO WorldId
getWorld BodyId
a0 =
  BodyId -> IO WorldId
c_b3Body_GetWorld BodyId
a0

{- | Get the number of shapes on this body

Binds @b3Body_GetShapeCount@.
-}
getShapeCount
  :: BodyId
  -> IO Int
getShapeCount :: BodyId -> IO Int
getShapeCount BodyId
a0 =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CInt
c_b3Body_GetShapeCount BodyId
a0)

{- | Get the shape ids for all shapes on this body, up to the provided capacity.

Returns: the number of shape ids stored in the user array

Binds @b3Body_GetShapes@.
-}
getShapes
  :: BodyId
  -> Ptr ShapeId
  -- ^ @shapeArray@
  -> Int
  -- ^ @capacity@
  -> IO Int
getShapes :: BodyId -> Ptr ShapeId -> Int -> IO Int
getShapes BodyId
a0 Ptr ShapeId
a1 Int
a2 =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> Ptr ShapeId -> CInt -> IO CInt
c_b3Body_GetShapes BodyId
a0 Ptr ShapeId
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2))

{- | Get the number of joints on this body

Binds @b3Body_GetJointCount@.
-}
getJointCount
  :: BodyId
  -> IO Int
getJointCount :: BodyId -> IO Int
getJointCount BodyId
a0 =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CInt
c_b3Body_GetJointCount BodyId
a0)

{- | Get the joint ids for all joints on this body, up to the provided capacity

Returns: the number of joint ids stored in the user array

Binds @b3Body_GetJoints@.
-}
getJoints
  :: BodyId
  -> Ptr JointId
  -- ^ @jointArray@
  -> Int
  -- ^ @capacity@
  -> IO Int
getJoints :: BodyId -> Ptr JointId -> Int -> IO Int
getJoints BodyId
a0 Ptr JointId
a1 Int
a2 =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> Ptr JointId -> CInt -> IO CInt
c_b3Body_GetJoints BodyId
a0 Ptr JointId
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2))

{- | Get the maximum capacity required for retrieving all the touching contacts on a body

Binds @b3Body_GetContactCapacity@.
-}
getContactCapacity
  :: BodyId
  -> IO Int
getContactCapacity :: BodyId -> IO Int
getContactCapacity BodyId
a0 =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> IO CInt
c_b3Body_GetContactCapacity BodyId
a0)

{- | Get the touching contact data for a body

Binds @b3Body_GetContactData@.
-}
getContactData
  :: BodyId
  -> Ptr ContactData
  -> Int
  -- ^ @capacity@
  -> IO Int
getContactData :: BodyId -> Ptr ContactData -> Int -> IO Int
getContactData BodyId
a0 Ptr ContactData
a1 Int
a2 =
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId -> Ptr ContactData -> CInt -> IO CInt
c_b3Body_GetContactData BodyId
a0 Ptr ContactData
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2))

{- | Get the current world AABB that contains all the attached shapes. Note that this may not encompass the body origin.
If there are no shapes attached then the returned AABB is empty and centered on the body origin.

Binds @b3Body_ComputeAABB@.
-}
computeAABB
  :: BodyId
  -> IO AABB
computeAABB :: BodyId -> IO AABB
computeAABB BodyId
a0 =
  (Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> BodyId -> Ptr AABB -> IO ()
c_b3Body_ComputeAABB BodyId
a0 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut

-- | Like 'computeAABB', but the result is written into a caller-supplied buffer.
computeAABBInto
  :: BodyId
  -> Ptr AABB
  -- ^ Result buffer.
  -> IO ()
computeAABBInto :: BodyId -> Ptr AABB -> IO ()
computeAABBInto BodyId
a0 Ptr AABB
out =
  BodyId -> Ptr AABB -> IO ()
c_b3Body_ComputeAABB BodyId
a0 Ptr AABB
out

{- | Get the closest point on a body to a world target.

Binds @b3Body_GetClosestPoint@.
-}
getClosestPoint
  :: BodyId
  -> Ptr Vec3
  -- ^ @result@
  -> Vec3
  -- ^ @target@
  -> IO Float
getClosestPoint :: BodyId -> Ptr Pos -> Pos -> IO Float
getClosestPoint BodyId
a0 Ptr Pos
a1 Pos
a2 =
  Pos -> (Ptr Pos -> IO Float) -> IO Float
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a2 ((Ptr Pos -> IO Float) -> IO Float)
-> (Ptr Pos -> IO Float) -> IO Float
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p2 ->
  BodyId -> Ptr Pos -> Ptr Pos -> IO Float
c_b3Body_GetClosestPoint BodyId
a0 Ptr Pos
a1 Ptr Pos
p2

{- | Cast a ray at a specific body using a specified body transform.

Binds @b3Body_CastRay@.
-}
castRay
  :: BodyId
  -> Pos
  -- ^ @origin@
  -> Vec3
  -- ^ @translation@
  -> QueryFilter
  -> Float
  -- ^ @maxFraction@
  -> WorldTransform
  -- ^ @bodyTransform@
  -> Ptr BodyCastResult
  -- ^ Result buffer.
  -> IO ()
castRay :: BodyId
-> Pos
-> Pos
-> QueryFilter
-> Float
-> WorldTransform
-> Ptr BodyCastResult
-> IO ()
castRay BodyId
a0 Pos
a1 Pos
a2 QueryFilter
a3 Float
a4 WorldTransform
a5 Ptr BodyCastResult
out =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a2 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p2 ->
  QueryFilter -> (Ptr QueryFilter -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with QueryFilter
a3 ((Ptr QueryFilter -> IO ()) -> IO ())
-> (Ptr QueryFilter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr QueryFilter
p3 ->
  WorldTransform -> (Ptr WorldTransform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with WorldTransform
a5 ((Ptr WorldTransform -> IO ()) -> IO ())
-> (Ptr WorldTransform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr WorldTransform
p5 ->
  BodyId
-> Ptr Pos
-> Ptr Pos
-> Ptr QueryFilter
-> Float
-> Ptr WorldTransform
-> Ptr BodyCastResult
-> IO ()
c_b3Body_CastRay BodyId
a0 Ptr Pos
p1 Ptr Pos
p2 Ptr QueryFilter
p3 Float
a4 Ptr WorldTransform
p5 Ptr BodyCastResult
out

{- | Cast a shape at a specific body using a specified body transform.

Binds @b3Body_CastShape@.
-}
castShape
  :: BodyId
  -> Pos
  -- ^ @origin@
  -> Ptr ShapeProxy
  -> Vec3
  -- ^ @translation@
  -> QueryFilter
  -> Float
  -- ^ @maxFraction@
  -> Bool
  -- ^ @canEncroach@
  -> WorldTransform
  -- ^ @bodyTransform@
  -> Ptr BodyCastResult
  -- ^ Result buffer.
  -> IO ()
castShape :: BodyId
-> Pos
-> Ptr ShapeProxy
-> Pos
-> QueryFilter
-> Float
-> Bool
-> WorldTransform
-> Ptr BodyCastResult
-> IO ()
castShape BodyId
a0 Pos
a1 Ptr ShapeProxy
a2 Pos
a3 QueryFilter
a4 Float
a5 Bool
a6 WorldTransform
a7 Ptr BodyCastResult
out =
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  Pos -> (Ptr Pos -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a3 ((Ptr Pos -> IO ()) -> IO ()) -> (Ptr Pos -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p3 ->
  QueryFilter -> (Ptr QueryFilter -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with QueryFilter
a4 ((Ptr QueryFilter -> IO ()) -> IO ())
-> (Ptr QueryFilter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr QueryFilter
p4 ->
  WorldTransform -> (Ptr WorldTransform -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with WorldTransform
a7 ((Ptr WorldTransform -> IO ()) -> IO ())
-> (Ptr WorldTransform -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr WorldTransform
p7 ->
  BodyId
-> Ptr Pos
-> Ptr ShapeProxy
-> Ptr Pos
-> Ptr QueryFilter
-> Float
-> CBool
-> Ptr WorldTransform
-> Ptr BodyCastResult
-> IO ()
c_b3Body_CastShape BodyId
a0 Ptr Pos
p1 Ptr ShapeProxy
a2 Ptr Pos
p3 Ptr QueryFilter
p4 Float
a5 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a6) Ptr WorldTransform
p7 Ptr BodyCastResult
out

{- | Overlap a shape with a specific body using a specified body transform.

Binds @b3Body_OverlapShape@.
-}
overlapShape
  :: BodyId
  -> Pos
  -- ^ @origin@
  -> Ptr ShapeProxy
  -> QueryFilter
  -> WorldTransform
  -- ^ @bodyTransform@
  -> IO Bool
overlapShape :: BodyId
-> Pos
-> Ptr ShapeProxy
-> QueryFilter
-> WorldTransform
-> IO Bool
overlapShape BodyId
a0 Pos
a1 Ptr ShapeProxy
a2 QueryFilter
a3 WorldTransform
a4 =
  Pos -> (Ptr Pos -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a1 ((Ptr Pos -> IO Bool) -> IO Bool)
-> (Ptr Pos -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p1 ->
  QueryFilter -> (Ptr QueryFilter -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with QueryFilter
a3 ((Ptr QueryFilter -> IO Bool) -> IO Bool)
-> (Ptr QueryFilter -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr QueryFilter
p3 ->
  WorldTransform -> (Ptr WorldTransform -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with WorldTransform
a4 ((Ptr WorldTransform -> IO Bool) -> IO Bool)
-> (Ptr WorldTransform -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr WorldTransform
p4 ->
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId
-> Ptr Pos
-> Ptr ShapeProxy
-> Ptr QueryFilter
-> Ptr WorldTransform
-> IO CBool
c_b3Body_OverlapShape BodyId
a0 Ptr Pos
p1 Ptr ShapeProxy
a2 Ptr QueryFilter
p3 Ptr WorldTransform
p4)

{- | Collide a character mover with a specific body using a specified body transform.

Binds @b3Body_CollideMover@.
-}
collideMover
  :: BodyId
  -> Ptr BodyPlaneResult
  -- ^ @bodyPlanes@
  -> Int
  -- ^ @planeCapacity@
  -> Pos
  -- ^ @origin@
  -> Capsule
  -- ^ @mover@
  -> QueryFilter
  -> WorldTransform
  -- ^ @bodyTransform@
  -> IO Int
collideMover :: BodyId
-> Ptr BodyPlaneResult
-> Int
-> Pos
-> Capsule
-> QueryFilter
-> WorldTransform
-> IO Int
collideMover BodyId
a0 Ptr BodyPlaneResult
a1 Int
a2 Pos
a3 Capsule
a4 QueryFilter
a5 WorldTransform
a6 =
  Pos -> (Ptr Pos -> IO Int) -> IO Int
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Pos
a3 ((Ptr Pos -> IO Int) -> IO Int) -> (Ptr Pos -> IO Int) -> IO Int
forall a b. (a -> b) -> a -> b
$ \Ptr Pos
p3 ->
  Capsule -> (Ptr Capsule -> IO Int) -> IO Int
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a4 ((Ptr Capsule -> IO Int) -> IO Int)
-> (Ptr Capsule -> IO Int) -> IO Int
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p4 ->
  QueryFilter -> (Ptr QueryFilter -> IO Int) -> IO Int
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with QueryFilter
a5 ((Ptr QueryFilter -> IO Int) -> IO Int)
-> (Ptr QueryFilter -> IO Int) -> IO Int
forall a b. (a -> b) -> a -> b
$ \Ptr QueryFilter
p5 ->
  WorldTransform -> (Ptr WorldTransform -> IO Int) -> IO Int
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with WorldTransform
a6 ((Ptr WorldTransform -> IO Int) -> IO Int)
-> (Ptr WorldTransform -> IO Int) -> IO Int
forall a b. (a -> b) -> a -> b
$ \Ptr WorldTransform
p6 ->
  CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BodyId
-> Ptr BodyPlaneResult
-> CInt
-> Ptr Pos
-> Ptr Capsule
-> Ptr QueryFilter
-> Ptr WorldTransform
-> IO CInt
c_b3Body_CollideMover BodyId
a0 Ptr BodyPlaneResult
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2) Ptr Pos
p3 Ptr Capsule
p4 Ptr QueryFilter
p5 Ptr WorldTransform
p6)