.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Finding angle at which a grenade hits a wall
Old
  (#1)
two_masks
Guest
 
Status:
Posts: n/a
Default Finding angle at which a grenade hits a wall - 10-05-2004

Hi yet again everyone,

Sorry for the deluge of questions recently. I'm now trying to determine the angle at which a grenade hits a wall. I have the grenade entity, but I'm not sure how to get the angle of a wall it hits relative to the grenades vector of motion.

Can someone help me with this? Thanks a lot.
  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#2)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Finding angle at which a grenade hits a wall - 10-05-2004

this may help you :

if you have two vectors, the dotproduct of the normalized vectors ( length is 1 ) of both ( dotproduct is sum over the products of the components x(i)y(i) ) is the cosine of the angle

the cool thing about it is that this simple stuff is working in n-dimensional vector spaces ( at least on kanonical bases )

€ : argh, what did I write
€^2: LA sucks btw ... at least the nontrivial stuff ... but somewhen you'll call everything trivial, so there is still hope



Last edited by @$3.1415rin; 10-05-2004 at 23:31..
  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#3)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Finding angle at which a grenade hits a wall - 10-05-2004

euh, what do you want to do with that information? If you want to let bots avoid grenade's , you can scan within a specific area for grenades and let bots just react on the grenade vector. Or, even more neat is to store it as a possible danger vector, then keep track if it gets closer , and if it does, then react on it.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#4)
two_masks
Guest
 
Status:
Posts: n/a
Default Re: Finding angle at which a grenade hits a wall - 10-05-2004

Well, I'd like my bots to run away from the grenade if it looks like it's going to bounce off a wall at a sharp angle, or run towards it if it looks like it's going to bounce at a shallow angle. I'm building these bots for a prototype simulation, not for real CS play, and this behavior is an approximation of diving for a grenade to throw it back if it's not bouncing around too much, or just running away if it doesn't look like it's catchable. Of course the bots won't actually be able to pick it up, but the important thing to show is that they "thought" to run after it in some cases. I chose the angle thing since CS doesn't let you vary the strength of your toss, so I had to choose another metric to base the decision on.

Any other tips? The dotproduct is useful, but the problem is that I don't have two vectors, just the edict of the grenade. If it's possible to get a vector for the wall, let me know!
  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#5)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Finding angle at which a grenade hits a wall - 10-05-2004

do a traceline along the estimated trajectory and then, if you hit the wall, the traceline function returns also a face normal of the wall


  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#6)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Finding angle at which a grenade hits a wall - 11-05-2004

s/"along the estimated trajectory"/"using the grenade edict's velocity"



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#7)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Finding angle at which a grenade hits a wall - 11-05-2004

what are you trying to say pierre ? what's that kind of syntax ?


  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#8)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Finding angle at which a grenade hits a wall - 11-05-2004

ah... it's Unix syntax "awk", I think (or is it "sed" ? can't remember).
means "replace item 1 with item 2"
used like this (on a forum or on Usenet) it means that by saying item2 you were probably meaning item1
That was just to make thins more clear



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#9)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Finding angle at which a grenade hits a wall - 11-05-2004

' s/"along the estimated trajectory"/"using the grenade edict's velocity" '
I first thought it's CCED and really surprised (may be unknown to you, but it's a very common text editor in mid-1990s in China - as well as WPS)
Looks like Zhu Chongjun has stole the awk syntax

Last edited by Whistler; 11-05-2004 at 14:48..
  
Reply With Quote
Re: Finding angle at which a grenade hits a wall
Old
  (#10)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Finding angle at which a grenade hits a wall - 11-05-2004

but I meant estimated trajectory, since most grenades do not fly a straight line ...

but estimated trajectory can still be a straight line, nevertheless ...


  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com