New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get arrows and spears to arc and perspectivize properly #46
Comments
Hey there! I've been looking into this issue for like 5 hours in a row today.
So you can't just migrate to different arrow speed that easily. At least, when affecting all levels. Maybe do this in some want-to-be-looking-good ones? PS by the way, on the screenshot, I did not declare enemy, but it still works and shows victory. That's because I'm always attacking enemies[0] actually. This is a poor solution and must not pass. |
Wow, thanks for figuring all that out. I've pulled in your changes and now added a "maximizesArc" config property to the Arrow, so you can toggle the old behavior vs. the new behavior. Check it out in the Arrow code in the live site. I liked how the arrows were arcing, but I realized that it had the same problem that everything else which arcs has: it looks too floaty. I think this is because we're using realistic world gravity of 9.82 m/s^2, but everything in the game is kind of super-sized. I tried setting Zone of Danger's gravity to 30 m/s^2 and the arrow arcs and jumping looked much cooler. I might try this on some more levels, too. If you grab the latest DB, you can try toggling the maximizesArc on in the Arrow config to see how it looks. I think that the change to gravity also made it so that attacking enemies[0] fails once more–at least, when I just tried it, it loses, whereas actually hitting the nearest one does succeed. |
also commented math's out.
I like this for Dungeon Arena, and it works when we are using I'm merging it in, but only when We don't yet have a way to selectively merge in part of the new dump. If you need stuff from your current DB and also from the new DB, then it has to be a manual process, either of bringing forward your old things after restoring the new dump, or of manually grabbing the new part of the new DB. |
Great! I hope that artisans will take this feature into account. |
I guess the thing that is needed is to not just infer the arrow's position along its flight path by its z-velocity, because that only works if the arrow is shooting from a position with equal z to its target. It should take into account the difference between the start and end z-values. |
Thanks for the diagram and for explaining it more. I played around with it and came up with something that appears to work almost perfectly in all the different cases I tried: vz = @thang.velocity.z
if vz and speed = @thang.velocity.magnitude(true)
vx = @thang.velocity.x
heading = @thang.velocity.heading()
xFactor = Math.cos heading
zFactor = vz / Math.sqrt(vz * vz + vx * vx)
rotation -= xFactor * zFactor * 45 Now I don't know why the |
Pleasant to see that you could match your desires with my solution! |
Currently when an Archer or Arrow Tower shoots an Arrow, the Arrow does properly rotate in the x-y plane so that it's facing its target, but it doesn't handle the other ones (yaw? pitch? roll?). So it doesn't point up when its z-velocity is positive, nor down when it's negative. It also doesn't appear shorter when flying more parallel to the camera's line of sight than it does when flying orthogonally.
I think one would just need to do some math to update the Arrow Thang's CocoSprite
imageObject
transform properties or their shorthands (scaleX
,skewY
,rotation
, etc.) according to thevelocity
of the Arrow and the Camera's view. I was trying to do it but got confused. If you like affine transforms or computer graphics, you might have some fun with this one!It's easy to test: just play Zone of Danger and get the arrows looking good. You might want to make the arrows travel a lot slower by editing their
maxSpeed
in theirmovement.Moves
Component, which would emphasize their arcs. One of the reasons arrows travel so fast now is that they don't look good when actually needing to arc.The code to write may be in or related to app/lib/surface/CocoSprite.coffee in the
updateScale
andupdateRotation
methods.The text was updated successfully, but these errors were encountered: