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.

Newcomers DBPro Corner / locking object to move with mouse

Author
Message
Stevie
User Banned
Posted: 28th Jul 2004 21:48
Been experiencing problems with 3d over the last few days, but seem to be getting some results now In my game i want my character to be central on the screen. I have done it moves through its animation cycle. However i want to lock it so that it moves when i use a mouse look. I have tried to lock it - but then this doesnt seem to work. I then try to use position x,y,z to the mouse coords but this doesnt work. The charcter moves with the terrain. Also i noticed that when i moved towards a wall or something in my game, my character loooked decidedly small in comparison to the wall.
Carlitos
21
Years of Service
User Offline
Joined: 8th Jul 2003
Location: United States
Posted: 28th Jul 2004 22:33
If by when you say it doesn't work, it might be that when you locked the object it's position is somewhere else, or at 0,0,0 in coorilation with the camera. Instead, either lock the object before positioning the camera, then position the object at 0,0,10(just to see where it is, remember, when you lock an object, its coordinate system is changed to be based around the cameras postion, so 1,1,1 wouldn't necessarily mean 1,1,1)

The problem with locking a main character object is that you would have to change the angle of the camera, and not the object, if you want to turn, say, right. The reason for this is that the object is locked to the camera, so 0,0,0 is the cameras position and angle, NOT the worlds postion.

Check the box to see a sample code, this will cause the camera to chase the object, just place CHASE_CAM(ID) in the main loop, oh and ID is the object number, so just make ID = 1. Hope that helps



Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 25th Aug 2004 01:52
Nice one Carlitos - solved my problem a month before I had it!!! Didn't realise object coordinates were relative to the camera.


Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 25th Aug 2004 22:58
Object coordinates are only "relative" to the camera if they have been locked to the camera. Otherwise they are relative to the three X, Y and Z worldspace axes.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home

Login to post a reply

Server time is: 2024-11-27 07:54:58
Your offset time is: 2024-11-27 07:54:58