Author Topic: Strato's Proof of Concept  (Read 9060 times)

what strato does is he looks at the list of impossible things to do in blockland and then makes sure to make an addon for all of them

That's my job




I would like to know more about how you got this done. :O

Do you think this could work on a flying vehicle as well?
I don't think so, but still, i can't really tell how you did this so i rather ask.

Right now the turret up and down rotation isn't too accurate when vehicle is on a slope but its an issue I'm looking into.
I am also looking into modularizing the algorithm so anyone can use it. So scripters out there, if you can see a way to make this code look a bit more pretty lemme know!

Code: [Select]
// function that rotates %v on the horizontal XY plane by %t angle in degrees
function rotateXYVector(%v,%t)
{
%x = getWord(%v,0);
%y = getWord(%v,1);
%z = getWord(%v,2);
return (   %x * mCos(%t * ($pi/180)) - %y * mSin(%t * ($pi/180))  ) SPC (   %y * mCos(%t * ($pi/180)) + %x * mSin(%t * ($pi/180)) SPC %z );
}

// run this part in a loop; doesn't have to be on a short delay because torque handles the turret aim easing.
{
    %pOffset = "10000000000000 0 0";

    %pVec = repeatedVectorAddwithScale(
%player.getEyeVector() SPC getWord(%pOffset,0) TAB
%player.getLeftVector() SPC getWord(%pOffset,1) TAB
%player.getUpVector() SPC getWord(%pOffset,2)
    );

    %pEyePos = vectorAdd(getWords(%player.getEyeTransform(),0,2),%pVec);    // define a position some distance away from the player eyepoint
    %tankRot = getWord(axisToEuler(%obj.getTransform()),2);                            // get base vehicles rotation in degrees
    %azimuth = getWord(axisToEuler(%obj.getTransform()),0);                           // get base vehicles forward angle
    // the true XY position is rotated to fix the issue mentioned in the dev notes
    %targetPos= getWords(rotateXYVector(%pEyePos,%tankRot * -1),0,1) SPC (%azimuth*-20000) + getWord(rotateXYVector(%pEyePos,%tankRot * -1),2);
    %obj.turret.setAimLocation(%targetPos);   // tell turret to aim at this target
}


That's awesome!
I wonder, is it possible to limit how fast can the turret turn? Or in some cases limit how much it can turn?

It can turn in the same angle as the player free-look. Its cannot do a full 360 turn in one direction but it can do a 175-ish degree left and right.


« Last Edit: January 02, 2015, 08:55:40 PM by Str4tofortress »


That reminds me of GTASA style of tank movement, and I love it!

Finally, something other than a damn car.
You're not forced to download anything though.

Strato, read the forum topic, make it happen. I believe in you. Portify help him
http://forum.blockland.us/index.php?topic=268889.0

That reminds me of GTASA style of tank movement, and I love it!
You're not forced to download anything though.
Well you know it would be nice to have some variation once in a while. But hey personal opinions don't matter right?
« Last Edit: January 03, 2015, 02:24:14 AM by Alkatjo »


Right now the turret up and down rotation isn't too accurate when vehicle is on a slope but its an issue I'm looking into.
I am also looking into modularizing the algorithm so anyone can use it. So scripters out there, if you can see a way to make this code look a bit more pretty lemme know!

You should use my advanced vector math resource; http://forum.blockland.us/index.php?topic=270070

Huh, thanks, i was thinking of this way of doing it once, but never really tried it out.
Figures that you would have to fix it up a bit still before it actually worked, but that is good to know.
Thanks a lot Strato, really nice.

Unbelievable, i made a suggestion topic asking for this exact thing, they all said it was impossible. God im pissed off now.
A lot of stuff gets called impossible, but it isn't always the case.
Sometimes it just requires a lot of effort and seems barely possible or it seems impossible.
But you can do a lot, especially if it is things like this.
It's just that not everything might be there currently to support it fully.

is a first person view for the tank possible?

Unbelievable, i made a suggestion topic asking for this exact thing, they all said it was impossible. God im pissed off now.
'Impossible' on the BLF means people are too lazy to do it so they just write it off so people stop asking them for it

Strato, read the forum topic, make it happen. I believe in you. Portify help him
http://forum.blockland.us/index.php?topic=268889.0
Although technically possible, it wouldn't turn out how you would think and isn't practical.