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.

Dark Physics & Dark A.I. & Dark Dynamix / [Darkphysics] Pointing at mouse

Author
Message
Oolite
18
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 9th Jul 2007 21:56
I have my 3d mouse code, and i want to point my object directly at the 3d mouse position, which is being represented with a box, how would i do this with a DP object?

Cheers


[Looking for work]
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Jul 2007 16:14
Do you mean using physics, or simply pointing it directly? For the latter, it's

phy set rigid body rotation number, x#, y#, z#

To do it physically would be tough, but I have a similar need. You could do something like...

phy add rigid body local torque number, forceX#, forceY#, forceZ#, mode

...and monitor the progress. At some point you will need to reduce the rotation velocity by applying reverse torque.

There are many different ways of applying the force, I don't know which is best.

Oolite
18
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 10th Jul 2007 22:08 Edited at: 10th Jul 2007 22:09

knocked that up quickly.
Forgot who the 3d mouse function is from, basically i just want to point the object at the box which is being placed at the mouse position.
Would i need to check for mouse move, then rotate the box according to how much the mouse has moved? But then how do i get the direction the object is facing in the first place to rotate the object?
I need it physical because the game i'm playing around with, he has to run through physics controlled doors and knock over boxes, i suppose i could control the character with DBPro commands then when he comes near to a box add a force to the box but it won't give the same feel as physics and wouldn't match the speed of the character.


[Looking for work]

Login to post a reply

Server time is: 2024-05-03 19:35:05
Your offset time is: 2024-05-03 19:35:05