From: SourceForge.net <no...@so...> - 2007-08-31 00:30:27
|
Patches item #1783048, was opened at 2007-08-27 21:34 Message generated for change (Comment added) made by macsforme You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=303248&aid=1783048&group_id=3248 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: BZFlag Group: None >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: Richard Bromley (rbromley256) >Assigned to: Nobody/Anonymous (nobody) Summary: TargetingUtils::getFirstCollisionPoint() Initial Comment: The function getFirstCollisionPoint() in src/bzflag/TargetingUtils.cxx does not appear to work correctly. getFirstCollisionPoint(src, target, collision_pt) uses ShotStrategy::getFirstBuilding() to find the time it will take for "src" to collide with stationary object "target", given the present velocity and direction of "src". getFirstCollisionPoint() creates a Ray object, initializing it with the current velocity and direction of "src", and then passes it to getFirstBuilding() to get the collision time. However, when getFirstCollisionPoint() creates the "src" Ray object to pass to getFirstBuilding(), it for some reason calls get3DUnitVector() to get the velocity parameter for the ray. I can't fathom how this was supposed to make sense, and it certainly doesn't work, as the collision time reported by getFirstBuilding() will in most cases be wrong. Instead, replace the "target" parameter with a float* velocity parameter, for the velocity of "src". Then use the velocity parameter in creating the ray for "src". This way, getFirstBuilding() will return the correct collision time. Attached is a file containing the old function and a new, correct function that returns the collision time, t, for a shot object, f. I have verified that it works, and it is now a part of my game client. (I use it to draw shot paths on my radar. I take t and multiply it with the current shot velocity to get the bullet's collision point. I then draw a line from the shot to the collision point on the radar. If there is no collision point, the line terminates where the bullet will expire. This is very handy for when you have a lot of bullets headed your way, and aren't very good at dodging. :) ) The reason why this bug hasn't caused many problems is because getFirstCollisionPoint() is only used in one place in the standard package, viz., by the autopilot AI. ---------------------------------------------------------------------- >Comment By: Joshua Bodine (macsforme) Date: 2007-08-30 17:30 Message: Logged In: YES user_id=1417147 Originator: NO Thank you for your bug report and file. Your new function will not integrate into the existing code without further modification. If you will submit a patch that contains the complete code changes needed to apply this, we will be glad to look at it once again. Thanks! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=303248&aid=1783048&group_id=3248 |