1 registered members (TipmyPip),
18,449
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Formula Cars "Editor" in game
[Re: Carloos]
#110819
02/21/07 05:14
02/21/07 05:14
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Quote:
* Click in 2D and get 3D cordinates is still bad, but works when you get the hummm hand on it... ( Maybe someone has a point and select script ? )
What's exactly your problem with this? Are you not getting the right 3D positions?
Using the following line should give you the exact 3D coordinates of a click: Code:
var pos1; var pos2; pos1.x = mouse_pos.x; pos1.y = mouse_pos.y; pos1.z = 0;//0 vec_for_screen(pos1, camera); pos2.x = mouse_pos.x; pos2.y = mouse_pos.y; pos2.z = 100000; //20000 use a big value here vec_for_screen(pos2, camera); trace_mode = ignore_passable + ignore_Sprites + ignore_models; target =0; c_trace(pos1, pos2,trace_mode);
After that simply save the 'target' it will return and use it. 
Cheers
|
|
|
Re: Formula Cars "Editor" in game
[Re: PHeMoX]
#110820
02/21/07 07:50
02/21/07 07:50
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Hey, that's very cool. I'm wondering: How did you do the "corners" if the selected unit? Are they just another model? Looks like it... but then how do you set it to be exactly the size your selected object? Or don't you?
An ingame editor's pretty cool. Does that mean you'll have a map editor in the game? but then what are you going to do with roads? they'll be hard to put in in an ingame editor...?
keep it up! Micha
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: Formula Cars "Editor" in game
[Re: PHeMoX]
#110823
02/21/07 14:12
02/21/07 14:12
|
Joined: Mar 2005
Posts: 514 Brazil
Carloos
OP
User
|
OP
User
Joined: Mar 2005
Posts: 514
Brazil
|
Quote:
Quote:
* Click in 2D and get 3D cordinates is still bad, but works when you get the hummm hand on it... ( Maybe someone has a point and select script ? )
What's exactly your problem with this? Are you not getting the right 3D positions?
Using the following line should give you the exact 3D coordinates of a click: Code:
var pos1; var pos2; pos1.x = mouse_pos.x; pos1.y = mouse_pos.y; pos1.z = 0;//0 vec_for_screen(pos1, camera); pos2.x = mouse_pos.x; pos2.y = mouse_pos.y; pos2.z = 100000; //20000 use a big value here vec_for_screen(pos2, camera); trace_mode = ignore_passable + ignore_Sprites + ignore_models; target =0; c_trace(pos1, pos2,trace_mode);
After that simply save the 'target' it will return and use it. 
Cheers
Thankyou for point me this, PHeMox, thats exactly what i´m doing.
But, instead of give me the exact clicked place, it gets me in the TARGET vector a place in between the camera and the place I had clicked. I got tired of trying tons of changes on it... so I decided to go ahead with the tool and maybe get some help from the community to correct this later.
|
|
|
Re: Formula Cars "Editor" in game
[Re: Germanunkol]
#110824
02/21/07 14:17
02/21/07 14:17
|
Joined: Mar 2005
Posts: 514 Brazil
Carloos
OP
User
|
OP
User
Joined: Mar 2005
Posts: 514
Brazil
|
Quote:
Hey, that's very cool. I'm wondering: How did you do the "corners" if the selected unit? Are they just another model? Looks like it... but then how do you set it to be exactly the size your selected object? Or don't you?
I make a loop through the entity vertices, and get theyr x,y,z lower and higher positions, from what I get its real rendered dimensions. Then I compare it with a model , 64 quants squared ( Its a model, AlphaChannel skin... ) and adapt its scale to fit exactly the model size. The result isnt perfect all times, anyway.
When making scaling calculations, I set the Pan/tilt/roll to Zero of both entities, to get exact or ( something so ) results, them I put them back to the original position.
When I get home I will post this simple code.
About maps, I think will not work with them.
Thankyou GermanUnkol
Last edited by Carloos; 02/21/07 14:18.
|
|
|
Re: Formula Cars "Editor" in game
[Re: Carloos]
#110825
02/21/07 15:49
02/21/07 15:49
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Quote:
Thankyou for point me this, PHeMox, thats exactly what i´m doing.
Your welcome. Well, the only thing that I had problems with was when I used this code but not used c_trace. Do you use c_trace too? If so, then I'm not sure what's wrong hehehe,
Cheers
|
|
|
Re: Formula Cars "Editor" in game
[Re: PHeMoX]
#110826
02/21/07 17:41
02/21/07 17:41
|
Joined: Oct 2005
Posts: 4,771 Bay City, MI
lostclimate
Expert
|
Expert
Joined: Oct 2005
Posts: 4,771
Bay City, MI
|
for line drawing use these functions:
rel_to_screen (VECTOR* vector, VIEW* view); draw_line(VECTOR*, COLOR*, var alpha)
look the up in the manual to see exactly how to use them, all you'd have to do is take a invisible box model scale it up and vec_lerp the distance between all 8 vertices to about 20% and draw from the vertex to that point
edit: Also carlos, sorry for hijacking your thread, the game looks, nice, i like the editor, and i have no idea how to fix your problem cuz that is how i would have done it too
Last edited by lostclimate; 02/21/07 17:42.
|
|
|
Formula Cars Editor Screenshot
[Re: Carloos]
#110828
02/25/07 22:08
02/25/07 22:08
|
Joined: Mar 2005
Posts: 514 Brazil
Carloos
OP
User
|
OP
User
Joined: Mar 2005
Posts: 514
Brazil
|
Hi. I´m just finishing the work for the in game editor i´m using in Formula Cars game, and just made this screenshot, I changed the style a lot and placed the editor panel in the left side of the screen. The object spawner opens a secondary little window with options to set, not yet finished, but close to it..  I already made an improvment with corners "drag´n drop" style control to set the region limits of the objects to be spawned. Interesting that after develop with some functionalities in mind, I ended up with some I didnt planned but worked also nice, as an example, the hability of move the corners of the selected regions also in the control panel :  The code inside the tool is interesting also to study and see how some functionalities were achieved, so I think this tool altought simple can be very usefull not only to populate or even build complete model only levels, but also to new people to learn. This tool will be basically free for use, and I´m already setting a C-Lite converted one to contribute.
|
|
|
|