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.

3 Dimensional Chat / camera problems -- rotating and moving....

Author
Message
Ebon
22
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 2nd Jan 2004 09:24
Hey, I need a little help with a camera that will retain its position relative to the object no matter where the object is placed or how it is rotated (upside-down and the like) any ideas?

That which does not kill us makes us stronger.
arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 2nd Jan 2004 17:30
position of camera relative to object:
relativex
relativey
relativez

position of object in space:
ojbx
objy
objz

final position of camera in space:
camerax=ojbx+relativex
cameray=ojby+relativey
cameraz=ojbz+relativez
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 3rd Jan 2004 01:01 Edited at: 3rd Jan 2004 01:06
objectID = 1 :` or what number matches your ship/object

X# = object position x(objectID)
Y# = object position y(objectID)
Z# = object position z(objectID)
Angle# = 0.0

` If you want a tail chasing camera, adjust Angle#.
` I like to slave the Angle# value to keys or the mouse
` to make an easy to use orbiting camera.
` Angle# = wrapvalue(object rotate y(objectID)+180.0)

Distance# = 100.0
Height# = 20.0
Smooth# = 1.0
Collision = 0

set camera to follow X#, Y#, Z#, Angle#, Distance#, Height#, Smooth#, Collision

` This command is important since it will lock your camera on
` to the object's location and keep it centered.
point camera X#,Y#,Z#

` This is all off the top of the head stuff, but it should work.
` Just stick in your main loop after your object moves.
--
TAZ
Ebon
22
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 4th Jan 2004 07:24
I've already thought of those, and the problem with them is that they can't handle the object turning upside-down. Or so I think...the set camera to follow command is what I had to start with but the angle it asks for is related to the Y angle of the object (I'm not totally sure about this, anyone know for sure?) - meaning the camera will rotate from side to side according to the angle #; I'm not concerned with this, I need the camera to pay attention to the object's X axis.
I hope this clears things up a bit
thanks for your time

That which does not kill us makes us stronger.
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 4th Jan 2004 19:41 Edited at: 4th Jan 2004 19:42
The SET CAMERA TO FOLLOW follows a 3d coordinate and not the object. The code sets the camera's following/point to be the same as the object's location. But, it is independent of the object's rotation (unless you uncomment a line in my example.)

You can set the angle to any value from 0 to 360 degrees, most folks just use the y axis rotation since for many games this is related to the object's facing.
--
TAZ
Ebon
22
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 4th Jan 2004 23:30
Yes, yes, I know that the command follows a coordinate and not an object, and you are right - I can set the angle value to any number I want from 0 to 360...but it's around the object's Y axis. How do I make it use X?

That which does not kill us makes us stronger.
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 5th Jan 2004 17:02 Edited at: 5th Jan 2004 17:07
Sorry, I was being thick headed there. What about attaching a limb and placing the camera at the end of the limb. You van rotate the limb around the X axis. All theory since I have not tried that technique, but I'll put it on my to-do list to try out.
--
TAZ

Side note: One of the things that I miss about WildTangent's API is that you could create groups, nested groups, and offset groups and add objects to these groups. It is an easy way to set up relationships between objects either as joints or orbiting bits.

Dark Basic does not have an easy way to set up a parent child relationship like that.
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 5th Jan 2004 18:09
I forgot to mention, my usual 'fix' for relative objects is to copy the positional and rotational data from the primary to the secondary object and then issue relative movement and rotation commands to create an offset location.

For example, let's say I wanted a camera to be behind and above and object no matter how it is rotated...



This is off the top of my head, please forgive any typos.
--
TAZ
Ebon
22
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 5th Jan 2004 22:03
It's all good, it was probably my fault for being unclear. I don't have enough time to look at the code and see if it will work for me right now, I'll check it out and get back to you on it. Thanks alot.


That which does not kill us makes us stronger.

Login to post a reply

Server time is: 2025-06-27 20:10:58
Your offset time is: 2025-06-27 20:10:58