Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Let's derive shooting with crosshairs.
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default Let's derive shooting with crosshairs. - 01-26-2012, 12:59 AM

There are a number of ways to fake a bullet shooting in the direction of the crosshairs. Back in the day, Counter Strike actually spawned bullets to the sides and behind the character to fake shooting at the crosshair. Normally the user is none the wiser. At least, until you see some guy using an AUG and yellow tracers are forming behind him.
Many games, like in the previous example, simply make a muzzle flash and an invisible bullet starts flying, spawned from the point of view of the camera.

For reference's sake, how do the "Object is * direction of object" work?
Say there's a cube. If I was in an area such that I was 3 meters in front of and to the left of the cube so that I'd be relative to a corner of the cube, would it register as both "In Front of the cube" and "To the left of the cube"?
Also, if I was only in front, and not left, right, on top, or on bottom of the cube, would it only register as being in front of the cube?
This is a very important conceptual question.
Alice doesn't have "Ray Casting," or "Ray Shooting", as Wikipedia calls it. Ray shooting is a very convenient thing used to solve many spatial distance issues in video games. Crosshairs are one of them. In essence, ray shooting is an invisible, extremely long finite line that projects outward from a source. In this case, our source is the camera. The idea is that it then finds the closest object that collides with the ray. After that, you may use trigonometry to find the precise angle of adjustment so that the bullet's path is altered to hit the crosshair dead on.
If there is no closest object (You point at the sky), the bullet's path is altered to hit the end of the ray, making it seem as if you were shooting at the center of the screen. Isn't that convenient?

The problem is, as I said before, Alice doesn't have raycasting. Nor will it get any, and that is why I asked the conceptual question.
And thus I propose an assignment to the Alice Community: Design a "ray casting" substitute that will fire to the center of the crosshair from the gun. It makes no difference to me how true to ray shooting your solution is, as long as it works with any distance. You probably shouldn't ask me how to do this either. I don't know, and that's about as good an answer as you'll get.
If you excuse me, I will find a scripting solution for this that hopefully involves raycasting.
   
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.