Bots and Simulations > DNA - General
How can you approximate sin-1?
MysticalDumpling:
I got a seemingly very effective calculator for shootval for a seen distance:
--- Code: ---*.body 2 logx 60 mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos sub abs 2 logx -1 mult .shootval store
--- End code ---
When I tried to use one to predict shootangle, it is 90deg. off to the right. It goes:
--- Code: ---*.refaim sin *.refvelscalar mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos div *.refaim sin *.refvelscalar mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos div 3 pow 6 div add *.aim sub .aimshoot store
--- End code ---
Neither of these have shot velocity factored in.
MysticalDumpling:
Alas, pre-emptive aiming and shooting eludes me. Some of my notes in a txt file might help someone open up this vault of secrets
updated .txt
MysticalDumpling:
I now have the "working" base for the pre-emtive aim:
--- Code: ---start
-40 *.eye9 sgn mult -30 *.eye8 sgn mult add -20 *.eye7 sgn mult add -10 *.eye6 sgn mult add 10 *.eye4 sgn mult add 20 *.eye3 sgn mult add 30 *.eye2 sgn mult add 40 *.eye1 sgn mult add .aimsx store
*.refaim sin *.refvelscalar mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos div *.refaim sin *.refvelscalar mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos div 3 pow 6 div add
.aimsx store
stop
--- End code ---
However (as noted in the txt), there are some issues:
--- Quote ---'The aiming kinda works- it shoots ahead of the bot. However, depending on how "late" in the cycle (?)
'or something like that, it does not hit. Not taking into account shot velocity causes problems as well.
'Another problem is that it overturns with large distances.
--- End quote ---
This might mean there is some problem in the math. Helpings?
MysticalDumpling:
I just realized I was spamming the thread. Sorry :wub:
Anyway, I think I realized my prob.- I used *.refaim, which is absolute aim. Instead, I should find the dir, convert it to deg (if is that necissary?), based on my bot's frame of reference.
I added *.aim sub to the end of every *.refaim. Now, it works a little better. However, sometimes it works, then it "randomly" rotates WAAAAY too far. Well, I'm getting somewhere... :dry:
Shadowgod2:
i can't help but notice that the equation doesn't factor in the vel of any bot as far as i can tell. this could help.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version