Can't Get "player.awayviewaiming" to Work

D00D64

Unresponsible
So I remembered an old script I had that I wanted to experiment with, and with just a bit of adjustment, I got it to work!... mostly.

ringracers0203.gif


Putting aside the distance for now, the main issue is that I can't seem to get player.awayviewaimingto actually do anything. Enabled or Disabled, the camera is identical, when what's supposed to be happening is that it vertically angles downwards to the small dot in between the player and the cursor.

For comparison, here's me haphazardly tossing the unedited SRB2 2.1 mod this script came from into SRB2 Kart, just to see what would happen.

kart0085.gif


This is how the mod is supposed to function, and while it was obviously not meant for Kart, it still works.

And this is the code, pardon the lack of notes.

Prototype Camera Code:
addHook("MapLoad", function()
    for player in players.iterate
        if not player.mo.cam
            player.mo.cam = P_SpawnMobj(player.mo.x, player.mo.y-192*FRACUNIT, player.mo.z+player.mo.height+100*FRACUNIT, MT_CUSTOMCAMERA)
            player.mo.cam.target = player.mo
            player.mo.cursor = P_SpawnMobj(player.mo.x, player.mo.y+25*FRACUNIT, player.mo.z+player.mo.height/2, MT_SHOOTCURSOR)
            player.mo.cursor.target = player.mo
            player.mo.dot = P_SpawnMobj(player.mo.x, player.mo.y+25*FRACUNIT, player.mo.z+player.mo.height/2, MT_SHOOTDOT)
            player.mo.dot.target = player.mo
        end
    end
end)

addHook("ThinkFrame", function(mo)
    for player in players.iterate
        if player.valid
        and player.mo.cam  
            player.awayviewmobj = player.mo.cam; player.awayviewtics = 2
            P_SetOrigin(player.awayviewmobj, player.mo.dot.x, player.mo.dot.y-192*FRACUNIT, player.mo.dot.z+100*FRACUNIT)
            player.awayviewmobj.angle = ANGLE_90
            player.awayviewaiming = R_PointToAngle2(0, player.mo.dot.z, R_PointToDist2(player.awayviewmobj.x, player.awayviewmobj.y, player.mo.dot.x, player.mo.dot.y), player.mo.dot.z)
           
        end
    end
end)

Am I doing something that would prevent awayviewaiming to work, or is this a Ring Racers difference that I'll need an entirely new method for?
Post automatically merged:

So, I looked into the source code, and awayviewaiming is not there, at all. Its there in SRB2 source, but its completely gone in this game for some reason... I'll need to find an alternative, I guess.

EDIT: OKAY I GOT IT: By giving my awayviewmobj a different pitch, I can change its aim angle.
Here, I set player.awayviewmobj.pitch to -ANGLE_45, which... probably isn't ideal, but it'll do for now.

ringracers0221.gif
 
Last edited:
Back
Top