Looking for opinions on this ticket:
http://wiki.neurohack.com/transcendence/trac/ticket/334
I just realized that sysCreateWeaponFire has a hidden feature: If you enter Nil for the direction (but still supply a target) then sysCreateWeaponFire will automatically aim the shot at the target (compensating for motion, etc.)
Is that enough to solve the ticket?
I can also add a new function:
(sysCalcFireSolution targetPos targetVel missileSpeed) -> angle to fire
[Where targetPos and targetVel are vectors relative to the firing platform.]
Aiming code
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
It was easy to add, so it will be in the next release.alterecco wrote:Personally I would not mind having access to a function that gave me the angle directly, but would not miss it much either
Unfortunately this gives the vector from the firing ship and my mod requires the vector from a shot object because I'm simulating not a turret but fragmentation.
I may be able to set the shot as the firer, but I expect this will lose the player blame or credit for any damage. I have an idea for a possible workaround, but it's very kludgy.
I may be able to set the shot as the firer, but I expect this will lose the player blame or credit for any damage. I have an idea for a possible workaround, but it's very kludgy.
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
I think I can fix this by using the position vector passed in to sysCreateWeaponFire instead of the position of the source object (that's definitely a bug). [Please check me on that.]Atarlost wrote:Unfortunately this gives the vector from the firing ship...
But regardless, I hope you can also use the new sysCalcFireSolution function.
[p.s.: Long-term I agree that we need floating-point manipulation functions, but this is easier and computationally faster.]
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
Nevermind, this won't totally work because there is no way to pass in the relative velocity of the target.george moromisato wrote:I think I can fix this by using the position vector passed in to sysCreateWeaponFire...
I think I will have to use the position passed in, but take the source velocity from the object.
If "blame" gets passed I could pass the shot object whose fragmentation I'm simulating in the second argument I think.
I suppose I should check that it's not before going any further.
Nope, that creates wildly unpredictable behavior and makes the shots fratricide.
Hmm. I see why the behavior has gone erratic. I'm moving the shot. I don't remember why.
Okay, sort of working. They're still fratriciding, but at least the survivor works right. You don't get blame for killing friendlies with it though.
Okay, I've got a workaround moving gSource around. http://xelerus.de/index.php?s=mod&id=706
I suppose I should check that it's not before going any further.
Nope, that creates wildly unpredictable behavior and makes the shots fratricide.
Hmm. I see why the behavior has gone erratic. I'm moving the shot. I don't remember why.
Okay, sort of working. They're still fratriciding, but at least the survivor works right. You don't get blame for killing friendlies with it though.
Okay, I've got a workaround moving gSource around. http://xelerus.de/index.php?s=mod&id=706
Doesn't it also need to take the firing platform?george moromisato wrote:I can also add a new function:
(sysCalcFireSolution targetPos targetVel missileSpeed) -> angle to fire
[Where targetPos and targetVel are vectors relative to the firing platform.]
(sysCalcFireSolution source targetPos targetVel missileSpeed)
To my mind, though, it would be most sensible if the firing platform and target are the same "kind" of thing.
Either
(sysCalcFireSolution source target missileSpeed)
where source and target are space objects
or
(sysCalcFireSolution sourcePos sourceVel targetPos targetVel missileSpeed)
with source and target as mere vector pairs.
In the latter case it's slightly more work to use where the source and target are preexisting space objects. In the former it's more work where they are locations with no objects, but temporary objects can be created and deleted for such situations, which should be rare. I therefore prefer the former.
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
You can use sysVectorSubtract to convert to vectors relative to the firing platform:Atarlost wrote:Doesn't it also need to take the firing platform?
Code: Select all
(sysCalcFireSolution
(sysVectorSubtract targetPos sourcePos)
(sysVectorSubtract targetVel sourceVel)
missileSpeed)