Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Object size as seen on screen?

Author
Message
deathAngel
23
Years of Service
User Offline
Joined: 11th Feb 2003
Location:
Posted: 9th Apr 2003 23:14
Hi guys. Could somebody help me with a code to get Object size as it seen on screen. I have been tryed Using object size(i) / distance# /200 .
distance#= sqrt((X2#-X1#)^2+(Y2#-Y1#)^2+(Z1#-Z2#)^2)
The 1st XYZ's are for the camera position and the 2nd XYZ's are for object position.
But it doesn't seem to work when I get to close to the object or when I change resolution.
Is there any good whay to do that?
(Sorry for the bad English).
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 10th Apr 2003 04:10
the size of the object doesnt change.

its the distance from the camera that make it looks large /small.

if u just create a primitve without positioning it and as well as the camera and while the automatic camera (autocam off/on) it will appear in front of the camera and appear really large.

You may want to create a size 1 cube for the camera location then using that to check the distance off.

this way the cube for the camera can take on all the required ground height checking etc. and the camera can be tagged off this so it can be raised or lowered or repositioned accordingly to where the psuedo camera cube is which can be hidden.

Sorry a bit long winded without pauses.

deathAngel
23
Years of Service
User Offline
Joined: 11th Feb 2003
Location:
Posted: 10th Apr 2003 06:39
Indi thanks for you're answer but as i said before, my
English is not so good, that's why i had a little trouble understanding the last part of it.

about the part were the size of the object doesn't change, and the distance from the camera is what makes it look larger/smaller, I know that and that is my actual problem to determine how the connected i mean if when the distance=10 between camera and object the size of the object on screen seems like 600 pixel, how big would it be (look like) when the distance is: -6000?
is there any mathematical way to calculate it using the actual size of the object because they are all different. and the screen resolution.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 10th Apr 2003 07:06
hmm not sure mate, Its probably beyond my maths skills to comprehend that, I posted a distance function above for you to try if u want to base it off the distance of two objects.

eg 1 cube is the screen or game object and the other cube is a hiden cube at the camera location.

Login to post a reply

Server time is: 2026-07-10 19:47:37
Your offset time is: 2026-07-10 19:47:37