Posted By: binsky33333
C-trace, click to place an object - 07/18/09 03:17
Hi everyone, i just have a quick question about using c_trace to place an object where i click. Ok basically i have a crosshair at the center of the screen. Basically what i need is when i click, a crate spawns on the ground, where the crosshair was pointed. Here is what i came up with so far.
Its kinda working out. Though it will only go 100 quants for the temp.z If i make it any more it becomes very inaccurate. Can someone help me?
BTW view_build is a camera.
Thanks!
Code:
temp.x = 399; temp.y = 299; temp.z = 100; vec_for_screen(temp, view_build); if(c_trace(temp, vector(0,0,-10000), NULL)) { ent_create("crate.mdl", temp, NULL); }
Its kinda working out. Though it will only go 100 quants for the temp.z If i make it any more it becomes very inaccurate. Can someone help me?
BTW view_build is a camera.
Thanks!