A few questions #28
Replies: 1 comment 2 replies
-
Hi @tonyfirgun
Pixi3D doesn't contain any collision detection methods but if you want a simple method for checking if two bounding spheres collides you can do something like this: function isIntersecting(a, b) {
return Vec3.distance(a.position, b.position) < (a.radius + b.radius)
}
let a = Mesh3D.createCube()
a.radius = 5
let b = Mesh3D.createCube()
b.radius = 10
if (isIntersecting(a, b)) {
console.log("collision!")
}
You can move and rotate the camera as any other Container3D object: Camera3D.main.x = 10
Camera3D.main.y = 10
Camera3D.main.z = 10
Camera3D.main.rotationQuaternion.setEulerAngles(0,45,0)
You can create a box by: let mesh = Mesh3D.createCube() For creating a sphere mesh you can create a sphere in Blender and then save as a gilt file and then import that in Pixi3D. You can check https://github.com/jnsmalm/pixi3d/blob/develop/examples/src/pbr.js for an example how to load an gilt file. |
Beta Was this translation helpful? Give feedback.
-
Hey there, I’m quite new to programming so please bear with me. I am creating a 2.5D game by having 3D scenes made through blender rendered out and then character sprites drawn over them through pixijs. I am wondering if I could accomplish this with pixi3D
Can I detect collisions? If so, where should I start?
How can I move and rotate the camera through code?
Can I create a mesh object box or sphere through pixi3d? In theory, I wanted to create an invisible box that represents where my 2d character would collide in a 3D world.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions