I´m thinking...
that taking a look at the space compas functions could reveal some of it...
trying to see if i can find the code.(why reinvent the deep bowl)
gave up on the space compas thingi.. because there is rotational matrixes involved.. not what we want..
however, then proceeded to check the scoop code and found this piece of information
Code: Select all
- (BOOL) canScoop:(ShipEntity*)other
{
if (other == nil) return NO;
if (![self hasScoop]) return NO;
if ([cargo count] >= max_cargo) return NO;
if (scanClass == CLASS_CARGO) return NO; // we have no power so we can't scoop
if ([other scanClass] != CLASS_CARGO) return NO;
if ([other cargoType] == CARGO_NOT_CARGO) return NO;
if ([other isStation]) return NO;
Vector loc = vector_between(position, [other position]);
if (dot_product(v_forward, loc) < 0.0f) return NO; // Must be in front of us
if ([self isPlayer] && dot_product(v_up, loc) > 0.0f) return NO; // player has to scoop on underside, give more flexibility to NPCs
return YES;
}
and then looked up the vector between function
Code: Select all
#define vector_between(a, b) vector_subtract(b, a)
This gives us code that tells us where we can scoop, in front and below, my educated guees is that v_up, which is a vector_up, that center is 0.0, to far down, then the number goes negative
The same can be done with vector_right..
so quick writing some code here that might work
Code: Select all
let radius_from_player_center = 10 // how for from player center we allow before something becomes active
let rf =radius_from_player_forward_center
let target_posistion = new Vector(system.mainStation.position)
let loc = new Vector(target_position.substract(player.position))
// maybe need to be the next commented line instead not sure....
// let loc = new Vector(player.position.substract(target_position))
// edited:::: sry..
let ori = player.orientation
ori.w = -ori.w
let ud = ori.vectorUp().dot(loc)
let lr = ori.vectorRight().dot(loc)
if(ud =< rf && ud => -rf && lr =< rf && lr => -rf)
{
do something
}
hope it works...
anyway.. remember that player, will in 1.72 need to be player.ship in many instances that deals with the players ship, instead of the characther player "himself".. player.credits will still work afaik... bot not
player.position, that will need to be
player.ship.position..