Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,631 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ent_creat question #332204
07/08/10 04:13
07/08/10 04:13
Joined: Jun 2009
Posts: 26
D
dd231 Offline OP
Newbie
dd231  Offline OP
Newbie
D

Joined: Jun 2009
Posts: 26
Hi,

I am having a problem creating a box at the desired location. It creates the box in location quite far from the actual mouse cursor. This is the function.

function create_bounding_box()
{
if(mouse_left_clicked == 0 && mouse_left == 1) mouse_left_clicked = 1;
if(mouse_left_clicked == 1)
{
ent_create(box_str,mouse_cursor,box_pointer);
mouse_left_clicked = 2;
}
if(mouse_left_clicked == 2 && mouse_left == 0) mouse_left_clicked = 0;
}

Re: ent_creat question [Re: dd231] #332206
07/08/10 04:25
07/08/10 04:25
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Here all you'll need, call this before main and all other functions:
Code:
int mouse_triger =0;
VECTOR temp;
ENTITY* eBall;


Call this in while loop in players code:
Code:
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
mouse_for_world();

And here is a function, needs to be right before players action:
Code:
function mouse_for_world ()
{
	if (mouse_left)
	{
		if(mouse_triger)
		{
			temp.x = mouse_pos.x;
			temp.y = mouse_pos.y;
			temp.z = 10000;
			vec_for_screen(temp,camera);
			if (c_trace(camera.x,temp,IGNORE_ME) > 0)
			{
				vec_set(eBall.x,target);
			}
			else
			{
				vec_set(eBall.x,temp);
			}
			mouse_triger = 0;
		}
	}
	else
	{
		mouse_triger = 1;
	}
}


And finaly, you need to create model in main function:
Code:
eBall = ent_create("earth.mdl",vector(25,25,-200),0);

Good luck laugh


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: ent_creat question [Re: 3run] #332208
07/08/10 06:44
07/08/10 06:44
Joined: Jun 2009
Posts: 26
D
dd231 Offline OP
Newbie
dd231  Offline OP
Newbie
D

Joined: Jun 2009
Posts: 26
Thanks so much! That worked perfectly... once again thanks.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1