Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
crosshair problem #378360
07/22/11 21:04
07/22/11 21:04
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
hi,
hope someone can help me,
got a problem with a 1st person shooter projekt
i created a gun with a c_trace now i want to craete a panel or a view entity as crosshair

can someone help me?

Re: crosshair problem [Re: GameScore] #378370
07/22/11 23:42
07/22/11 23:42
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
i think you need to make use of this: http://www.conitec.net/beta/avec_to_screen.htm
to get the screen coordinates from the players view to 2D, to show the panel at the returned XY coords..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: crosshair problem [Re: Espér] #378376
07/23/11 05:44
07/23/11 05:44
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
Why don't just plase panel at the center of the screen? What for he needs avec?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: crosshair problem [Re: Espér] #378393
07/23/11 12:16
07/23/11 12:16
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
Hi,
i was try to do this with vec_for screen
but it doesnt work
did you have a code sample for me
maybe i forgot something or do something wrong

Code:
vec_set(crosshair,target);
      vec_for_screen(crosshair,camera);



Re: crosshair problem [Re: GameScore] #378400
07/23/11 13:03
07/23/11 13:03
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
Why you need to set panel on target? Just place it in the middle of the screen. Do you need me to show you how to do that?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: crosshair problem [Re: 3run] #378406
07/23/11 13:57
07/23/11 13:57
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
hi,
i know how to set a statical panel or view entity
i try to explain what i mean

my weapon is a view entity
but its not statical
i can move the gun on pan and tilt
and from gun.x there goes a c_trace to gun.x+10000
this is where the bullet fly if i shot
and now i need a panel who follows the target point
but the problem i have is to bring the world coords to screen coords
i was try to create an entity on target.x
it works fine but the problem ist if the distance between the gun and the target point grows, the entity scaled down

so i need a panel or something like this who follows the target point on the screen coords

got me?

Re: crosshair problem [Re: GameScore] #378407
07/23/11 14:12
07/23/11 14:12
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
gun.x is a view entity?
Anyway, try this one (not tested):
Code:
// here is your trace
if(trace_hit)
{
    vec_set(temp,target.x);
    vec_to_screen(temp,camera);
    panel.pos_x = temp.x;
    panel.pos_y = temp.y;
}

I hope this works. Please notice that you need to use "vec_to_screen" not "vec_for_screen", read manual carefully.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: crosshair problem [Re: 3run] #378411
07/23/11 14:50
07/23/11 14:50
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
how can i use a panel?
i was try with an view entity
but it doesnt work
and i have no idea how to do with an panel

Re: crosshair problem [Re: GameScore] #378414
07/23/11 15:14
07/23/11 15:14
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
Just make panel:
PANEL* test =
{
bmap = insert bmap
flags = SHOW;
}
And try to use script I gave you.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: crosshair problem [Re: 3run] #378445
07/23/11 19:07
07/23/11 19:07
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
works awesome!
thank you man!

so simple
how i could be so stupid
a flash should hit me when i crap

Page 1 of 2 1 2

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

Gamestudio download | chip programmers | 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