mirror of
https://github.com/troisjs/trois.git
synced 2024-11-27 14:02:01 +08:00
added mesh initial velocity setter
This commit is contained in:
parent
0b19982e39
commit
d0a5621d5d
@ -111,7 +111,12 @@ export default function useCannon(options) {
|
|||||||
const mass = mesh.userData.mass ? mesh.userData.mass : 0
|
const mass = mesh.userData.mass ? mesh.userData.mass : 0
|
||||||
const damping = mesh.userData.damping ? mesh.userData.damping : 0.01
|
const damping = mesh.userData.damping ? mesh.userData.damping : 0.01
|
||||||
|
|
||||||
const body = new Body({ shape, position, quaternion, mass, linearDamping: damping, angularDamping: damping })
|
const velocity = mesh.userData.velocity ? new Vec3(
|
||||||
|
mesh.userData.velocity.x,
|
||||||
|
mesh.userData.velocity.y,
|
||||||
|
mesh.userData.velocity.z) : new Vec3(0, 0, 0)
|
||||||
|
|
||||||
|
const body = new Body({ shape, position, quaternion, velocity, mass, linearDamping: damping, angularDamping: damping })
|
||||||
world.addBody(body)
|
world.addBody(body)
|
||||||
|
|
||||||
mesh.userData.body = body
|
mesh.userData.body = body
|
||||||
|
Loading…
Reference in New Issue
Block a user