Distance value between pivot and entity surface

Blitz3D Forums/Blitz3D Programming/Distance value between pivot and entity surface

Naughty Alien(Posted 2008) [#1]
..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)?


Ross C(Posted 2008) [#2]
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?


Naughty Alien(Posted 2008) [#3]
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)..


Ross C(Posted 2008) [#4]
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)


Naughty Alien(Posted 2008) [#5]
..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..


Ross C(Posted 2008) [#6]
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?


Naughty Alien(Posted 2008) [#7]
..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..


Ross C(Posted 2008) [#8]
I'm afraid the easiest way would be with the built in blitz3d collision commands. Set the camera collision sphere to a bigger radius...


Naughty Alien(Posted 2008) [#9]
thats not good..if part of geometry end up between camera and main character, camera will stuck..


Naughty Alien(Posted 2008) [#10]
..


Warner(Posted 2008) [#11]
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:



boomboom(Posted 2008) [#12]
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.