Distance value between pivot and entity surface
Blitz3D Forums/Blitz3D Programming/Distance value between pivot and entity surface
| ||
..what would be cheapest way to achieve this? I mean, to get distance between pivot point for example and any side of cube (pivot is placed inside cube)? |
| ||
So, you have a pivot placed inside a cube? And you want to know the distance between the pivot and the face of the cube? |
| ||
well..that was just simplified example...pivot can be within any shape and I want to efectively know shortest distance between pivot and some other object surface(not object pivot).. |
| ||
I think i get you now. How quick does this need to be performed? Every frame, or just a one off? And what are you using it for? Just incase there is anyway round this :o) |
| ||
..actually I just want to control my camera properly without using any collision type..practically not hitting ground or walls , etc..I do have some code whats working, but its collision based, and I dont want that.. |
| ||
Ah i see. Linepicks may help you out, but i'm not sure how many you'd need. You would only need to look in the direction your travelling though. I take it that it will be a crowded scene your camera is travelling through? |
| ||
..its tomb raider style camera, so i just want to define minimum distance from any geometry..I also need that for 'rubber' howercraft kind thingy, with 4 alignment points moving separate and therefore moving specific bones so its looking really softy in motion..again, i did it with raypick(PhysX), but im trying to cut down things and do much as i can within B3D without external libs, much as i can.. |
| ||
I'm afraid the easiest way would be with the built in blitz3d collision commands. Set the camera collision sphere to a bigger radius... |
| ||
thats not good..if part of geometry end up between camera and main character, camera will stuck.. |
| ||
.. |
| ||
Maybe this code might help a little ? It returns the distance between a point and a plane. If your meshes are convex, you could perhaps check the distance from the point to each face, and take the shortest distance: |
| ||
http://www.blitzbasic.com/toolbox/toolbox.php?tool=49 This can return the response 'do nothing' So you can use collision detection and not have it 'stuck'. Not sure if the blitz version is still avaliable as it lists only c++ and DB on the site, so best to email him. |