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 / Computer "thinks" too fast.

Author
Message
Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 8th Apr 2010 20:09
Im trying to write this small editor and I started by adding a car onto a matrix and when you hold down a certain number the corrisponding mesh is added to the y and z value of the car and the x value of the mouse. This all works fine and good but how do I stop it creating more than one of the model as the model amount variable goes up by 3-5 each time. I've tried many things but I cant crack it. It might be the way I am cloning the objects if so could you show me a different method on completing this. Also could anyone explain to me once and for all on 3d mouse cords. I have looked in many snippets but I just dont understand it. My code is uploaded with media. Thanks alot.

Gingerkid Jack - Aspiring Game Designer\3d Modeler

Attachments

Login to view attachments
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th Apr 2010 20:21
Just add a simple:



after the object in question is created.

TDK

Gingerkid Jack
19
Years of Service
User Offline
Joined: 15th May 2005
Location: UK
Posted: 8th Apr 2010 20:28
Great, thanks alot man it works perfectly. Could you explain to me about the get vector and pick vector or what ever its called commands please?

Gingerkid Jack - Aspiring Game Designer\3d Modeler
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 9th Apr 2010 23:24
I assume you want to use it to enable the user to click somewhere and know where in the 3D world they clicked?

In that case, it's pretty simple. You use:



Imagine that when you use this command, the program shoots an invisible ray from the camera toward the point the mouse is pointing at. You use GET PICK VECTOR X(), GET PICK VECTOR Y(), and GET PICK VECTOR Z() to get the coordinates in 3D space where the ray hit an object.

Alternatively, you can use PICK SCREEN instead of pick object, which instead of stopping when it hits an object, stops when it reaches a certain distance from the camera.

Login to post a reply

Server time is: 2024-09-28 16:29:21
Your offset time is: 2024-09-28 16:29:21