2 registered members (AndrewAMD, VoroneTZ),
1,258
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: accurate mouse3d function
[Re: MrCode]
#166955
02/27/08 08:08
02/27/08 08:08
|
Joined: Dec 2004
Posts: 237
Hani
Member
|
Member
Joined: Dec 2004
Posts: 237
|
hi, i'm testing this code with A7.07 , but i'm not getting the same results , insted i'm having bad results , the object is sometime created to the left or right of my mouse curcer .
any idea ?
The deference between madness and geniuses is success
|
|
|
Re: accurate mouse3d function
[Re: Joozey]
#215921
07/14/08 02:13
07/14/08 02:13
|
Joined: Jun 2008
Posts: 19
halfpint
Newbie
|
Newbie
Joined: Jun 2008
Posts: 19
|
Edit: Fixed my first problem but i don't want you to be able to load entities on top of each other, so i tried to use scan texture for the warlock model but i cant get it too work so if anyone could help me out that would be very helpful. I have the general idea i am probably just missing one thing.
So this is my attempt after all the vector stuff:
c_trace (camera.x,mouse_click,IGNORE_PASSABLE | SCAN_TEXTURE | IGNORE_MODELS); string model_name = "warlock.mdl"; if ((str_cmpi (model_name,tex_name)) ==0 ) { ent_create ("warlock.mdl" , target.x,NULL); }
this all works for creating the entity but it will still make it even if im on top of another one which is what im trying to make it not do. Also im using c-script. Thanks.
Last edited by halfpint; 07/14/08 08:55.
|
|
|
Re: accurate mouse3d function
[Re: halfpint]
#222929
08/21/08 17:07
08/21/08 17:07
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
use if(!mouse_ent){
//do your sexy thang
} then if you click on a model it'll be ignore though if you want something more than that you'll need to set up a basic node storage and work with tiles
|
|
|
Re: accurate mouse3d function
[Re: MrGuest]
#299743
11/26/09 15:54
11/26/09 15:54
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
OP
Expert
|
OP
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
Here is a working code for isometric view:
VECTOR mouse_click;
void mouseTo3D() {
while (1) {
if (mouse_left) {
vec_set (mouse_click, mouse_dir3d); //get direction vector from mouse to world
vec_normalize(mouse_click, 4000); //give it a large distance for tracing
vec_add (mouse_click, mouse_pos3d); //calculate from camera mouse in 3d position
c_trace (mouse_pos3d, mouse_click, IGNORE_MODELS); //trace from isometric 3d mouse position to clicked position (= mouse position + 4000 in depth)
vec_set( mouse_click, target );
ent_create ("warlock.mdl", mouse_click, NULL); //accurate warlock placement!
}
wait(1);
}
}
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
|