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 / Turn camera left/right

Author
Message
zerosimms
15
Years of Service
User Offline
Joined: 25th Feb 2011
Location:
Posted: 26th May 2011 19:16
Does anyone know if there is a way to find the value of the camera left and right positions?



I have a crosshair that turns the camera left and right and I need a bullet (sphere) to appear in the middle of the crosshair which is movable with the mouse. At the moment the sphere is created when the fire button is pressed but never in front of the camera positions and I think that's because I've turned the camera left or right.

www.bensimms.co.uk
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 26th May 2011 19:21
Position the sphere in the same location as the camera.

Use SET OBJECT TO CAMERA ORIENTATION to rotate the sphere to the same angles as the camera.

Move the sphere forward to the position you want it.

zerosimms
15
Years of Service
User Offline
Joined: 25th Feb 2011
Location:
Posted: 26th May 2011 19:52
Hey Kistech,

My Main camera is number one, how can I set object to camera orientation 1?

www.bensimms.co.uk
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 26th May 2011 20:07
rotate object x, camera angle x(1), camera angle y(1), camera angle z(1)

The set orientation command does basically the same thing.

zerosimms
15
Years of Service
User Offline
Joined: 25th Feb 2011
Location:
Posted: 27th May 2011 16:04
Umm... Still can't get it working. The object(1) follows the camera when I move forward, back, up or down but as soon as I turn the camera (1) left or right the object(1) sticks in its current position.

Camera controls:

Camera tracking code:

Bullet Code:

Any ideas what I'm doing wrong?

www.bensimms.co.uk
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 27th May 2011 21:27
You're rotating the object using the camera POSITION data, when you need to use the camera ANGLE.



That should put the object 10 units directly in front of the camera at all times.

zerosimms
15
Years of Service
User Offline
Joined: 25th Feb 2011
Location:
Posted: 27th May 2011 22:00
Sir! You are a legend!!! Thank you so much, that's now working a treat, what a relief!

www.bensimms.co.uk
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 27th May 2011 23:18
No problem.

Login to post a reply

Server time is: 2026-07-11 12:38:36
Your offset time is: 2026-07-11 12:38:36