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
0 registered members (), 16,232 guests, and 5 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
Problem with View Entity #190617
03/28/08 15:37
03/28/08 15:37
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
As an examplo im using this code that is in the manual
Code:

entity shotgun_onscreen
{
type = <shotgun.mdl>;
layer = 2; // display above view entities with layer 1
flags = visible;// visible on screen from the start
view = CAMERA; // same camera parameters as the default view
albedo = 50; // gouraud shading from sun position
x = 100; // place 100 quants ahead of the view
y = -50; // 50 to the right
z = 0; // and center vertically
}



THE PROBLEM:
I have a code that creates a smoke particle, and the initial position of this particle SHOULD be "shotgun_onscreen.x"
but it looks like the engine doesnt recon that shotgun_onscreen is an entity.
so if I put something like this

Code:

effect(starter_weaponfire,10,shotgun_onscreen.x,vector(0,0,20));



it creates the particle in the middle of the map, so it seems that shotgun_onscreen.x is equal to 0!

help?
thanks

Re: Problem with View Entity [Re: DestroyTheRunner] #190618
03/28/08 19:31
03/28/08 19:31
Joined: Feb 2008
Posts: 337
V
Vadim647 Offline
Senior Member
Vadim647  Offline
Senior Member
V

Joined: Feb 2008
Posts: 337
try using:
Code:

vec_set(temp,vector(100,-50,0));
vec_rotate(temp,camera.pan);
vec_add(temp,camera.x);
effect(starter_weaponfire,10,temp.x,vector(0,0,20));


temp is just any temporary vector pointer.

particles maybe spawn on point (100,-50,0)
your code will work if gun positioned by code, not engine.


I switched to other account since marth 2010. Guess which.
Re: Problem with View Entity [Re: Vadim647] #199576
03/31/08 12:49
03/31/08 12:49
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
thanks it does work.
but there is no way to me to use coordinates based on this type of entity definition?
 Code:
entity shotgun_onscreen{  
type = <shotgun.mdl>; 	
layer = 2; // display above view entities with layer 1 	
flags = visible;// visible on screen from the start 	
view = CAMERA; // same camera parameters as the default view albedo = 50; // gouraud shading from sun position 	
x = 100; // place 100 quants ahead of the view 	
y = -50; // 50 to the right 	
z = 0; // and center vertically
}


SECOND QUESTION
can I animated an entity like mentioned above?

because if both of this question the answers in no, them I´ll cannot use it, since i need to the entity "shotgun_onscreen" be animated.

thanks

Last edited by DestroyTheRunner; 03/31/08 12:52.
Re: Problem with View Entity [Re: DestroyTheRunner] #199772
04/01/08 10:50
04/01/08 10:50
Joined: Apr 2007
Posts: 582
Germany
Poison Offline
User
Poison  Offline
User

Joined: Apr 2007
Posts: 582
Germany
TO THE SECOND QUESTION
Of course can you animate you Entity.
just animate it like a normal modell, via ent_animate \:\) .


Everything is possible, just Do it!
Re: Problem with View Entity [Re: Poison] #199798
04/01/08 11:56
04/01/08 11:56
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
Ok
but if the engine doesnt let me use stuff(or gives me error) when i use stuff like "shotgun_onscreen.x" , will it let me use eg.:
"ent_animate(shotgun_onscreen,NULL,0,0);" ???

thanks

Re: Problem with View Entity [Re: DestroyTheRunner] #200128
04/02/08 17:36
04/02/08 17:36
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
I need a hand here..
someone?


EDIT. actually what I need, is the global position of a given VIEW ENTITY.

Which its not been possible, If i set a particle to spawn at:
eg.
shotgun_onscreen.x
shotgun_onscreen.y
shotgun_onscreen.z

the particles gets created at the middle of the level. and not at the real position.
As previous posts showed me that its possible to get the same effect using
another code not using the shotgun_onscreen entity.

but i NEED the real position of a view entity.(in my case shotgun_onscreen.x be a real global position)

HELP \:\(



Last edited by DestroyTheRunner; 04/02/08 18:10.
Re: Problem with View Entity [Re: DestroyTheRunner] #200145
04/02/08 19:46
04/02/08 19:46
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
 Quote:

vec_for_screen ( VECTOR*, VIEW*);
The opposite of the vec_to_screen instruction. It converts XY screen coordinates, given through the vector, to a world position of the given view. Because a unique 3D position can not be determined from a XY screen position alone, a depth must also be given in the Z coordinate of the vector. The view must be visible for this instruction to work. This instruction can be used to place entities into a level on mouse click on the screen.
Parameters:
VECTOR* vector to be converted
VIEW* View pointer to be used for the conversion
Returns:
NULL - Result is outside the view cone.
VECTOR* - Result is inside the view cone.
Modifies:
VECTOR*
Speed:
Fast
Example:
 Code:
function spawn_sprite()
{
  // spawn a sprite at mouse click position, 200 quants behind the screen
  temp.x = mouse_pos.x;
  temp.y = mouse_pos.y;
  temp.z = 200;
  vec_for_screen(temp,camera);
  ent_create("arrow.pcx",temp,NULL);
}
...
on_mouse_left = spawn_sprite; 


Source:
http://manual.conitec.net/avec_for_screen.htm

Re: Problem with View Entity [Re: Xarthor] #200153
04/02/08 20:02
04/02/08 20:02
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
ok
I think you misunderstood me. :p

Doesnt a view entity a real entity?

eg.
Entity shotgun_onscreen{}

I need this view entitiy to it be a real entity.

edit. example, when i shoot with my gun, a smoke particle will be created at this view entity position, which occurs to be a gun. thats why i need this view entity to be a real entitity.. so i can access its data like any other entity.


Last edited by DestroyTheRunner; 04/02/08 20:08.
Re: Problem with View Entity [Re: DestroyTheRunner] #200289
04/03/08 12:38
04/03/08 12:38
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Then you need to create it using "ent_create" (or place it inside the level and give it a function) and attach it to the camera at each frame.
To avoid "player-stucks-in-weapon-and-is-unable-to-move" situations:
- ignore_push for the player
or: - passable for the gun

To prevent the gun from "going-into-walls":
- znear flag for the gun

edit:
Please excuse my stupidity!
You can of course also use rel_to_screen and rel_for_screen:
http://manual.conitec.net/avec_rel_for_screen.htm

Last edited by Xarthor; 04/03/08 12:43. Reason: stupidity
Re: Problem with View Entity [Re: Xarthor] #200316
04/03/08 14:26
04/03/08 14:26
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
thaaanks \:\)

I just thought that view entities could be used as normal entities.

thanks Xarthor


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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