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 / get real objheight?

Author
Message
Mugen Wizardry
User Banned
Posted: 17th Aug 2010 18:13
Can someone tell me how to get the real height of an object? I want to position a sphere above my players head and point the camera towards it so the camera zooms in on the hidden sphere instead of the player and causes zoom problems.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 18th Aug 2010 00:20
I think the command is Object Size Y(), it returns the height (y axis) of an object.

Mugen Wizardry
User Banned
Posted: 18th Aug 2010 00:54
um. tried that. it doesnt give the correct value.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 18th Aug 2010 01:19
Have you resized the object? There is an optional flag for the Object Size Y() command which instructs it to take scaling into account.

Failing that it is returning the "height" of the object (Your player character), so if the offset point is set to the players middle (for example), then you'd need to divide the "height" by 2.

If all else fails, show some code? I just wrote a quick snippet and the object size commands definately work correctly for me on a range of objects/models.

Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 18th Aug 2010 04:52 Edited at: 18th Aug 2010 04:56
Just to clarify, here is a code snippet for you to use:



That should work. I haven't tested it, I wrote in this message box.

EDIT: I did go and test now, changed a couple of things, and it works now.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 18th Aug 2010 15:10
Maybe your objects center is not midpoint of the y axis? ie your using the correct result incorrectly?
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 19th Aug 2010 20:36
Yes check your objects pivot point in a 3d package, or just postion at 0,0,0 with a matrix or a plane positioned at the same place to see if its off center.

http://s6.bitefight.org/c.php?uid=103081
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Aug 2010 21:31
When you make your character, you can assign a limb that you want to use as your camera's look-at, then hide the limb.

The fastest code is the code never written.
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Aug 2010 02:01
You can also loop though all the vertices and find the maximum/minimum value.

Cheers!
Sven B

Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 20th Aug 2010 12:41
My code (above) simply shows how to use the commands, but yes, you should make sure your model has it's centre at it's real centre. Use Blender (it's free) to check.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.

Login to post a reply

Server time is: 2026-07-25 17:49:31
Your offset time is: 2026-07-25 17:49:31