Collisions on negative scaling

Blitz3D Forums/Blitz3D Beginners Area/Collisions on negative scaling

Ryudin(Posted 2007) [#1]
How do I do collisions if I scale a cube negatively?


Mattizzle(Posted 2007) [#2]
Does it not collide regularly?

Why are you scaling negativily? If You're just trying to turn a cube into a room with a texture, try FlipMesh() instead.


_PJ_(Posted 2007) [#3]
perhaps disabling backface culling might work (but it'll slow things down too)

Fl;ipMesh is definitely a betetr solutin IMO


Ryudin(Posted 2007) [#4]
Tried that already. Just did the same old thing, but I'll try again. Thx.


Zethrax(Posted 2007) [#5]
Disabling backface culling only works with the rendering, not the dynamics stuff, as far as I know.

Collisions and picking only work against the frontfaces of triangles, Ryudin. If you flip or scale a cube mesh so that it is inside out, you will be able to collide and pick the inside of the mesh, but not the outside. To collide and pick both, just create a duplicate mesh and leave one of the meshes unflipped/unscaled so you have corresponding triangle frontfaces pointing in opposite directions. Use EntityAlpha entity, 0.0 if you dont want one of the meshes rendered.


Ryudin(Posted 2007) [#6]
Thanks. I'm working on my first B3D game (Attack of the Cones) and I'm a bit iffy, having only worked with 2D before. What about collisions with the camera in first person view? Would I just give it an EntityRadius as normal or just create another entity to test the collisions for the camera?


Ryudin(Posted 2007) [#7]
Oh no. The FlipMesh stops the collisions completely, but I added a radius on the camera and it turns out that I can collide with the invisible outside, bit not the inside like I want. HELP!!


Zethrax(Posted 2007) [#8]
Cameras are just another type of entity. Use the standard collision commands to give the camera a collision ellipsoid.

Assuming you created two meshes and flipped one like I suggested, are you sure you set up collisions for both meshes. CopyEntity will copy the collision setup but I'm not sure if CopyMesh does. If not, you'll need to manually setup collisions with the copy.

Also bear in mind that when you use CopyEntity to copy a mesh, the mesh data itself isn't copied, but is referenced from the original mesh instead, whereas CopyMesh actually copies the mesh data to the new mesh entity. If you do a CopyEntity and then a FlipMesh, both mesh entities will get flipped as they both share the same mesh data.


Ryudin(Posted 2007) [#9]
Thanks a lot. I appreciate it. I'll try all of that and see if it works (which I'm sure it will). I might upgrade one of my school projects to 3d. If I do, I'll need to be a lot better at collisions than I am.


Mattizzle(Posted 2007) [#10]
Just something I learned about "foruming". I like to try out suggestions and see if they work before I reply to them, it just saves time and an edit. :-P

This is a really helpful topic by the way, I know I've learned something.