Announcement

Collapse
No announcement yet.

Scale vehicles in-game when spawning

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scale vehicles in-game when spawning

    Ok, so this works for the most part. If I say newvehicle = spawn(spawn a manta here) and vehiclescale is .5 then I get a half sized manta. It looks just like it should, problem is that even though it looks half size, it hits a wall just the same as the full size, as if the manta invisibly extends to the full size. If someone shoots the manta, they only make contact if the hit the visible half size manta, so that works correctly. What am I missing here? Primarily the only thing not working is that it still collides with the map as if it were the original size.

    Code:
            if (class<onsvehicle>(VehicleClass)!=none && vehiclescale != 1) {
                newvehicle.SetCollisionSize(newvehicle.CollisionRadius*vehiclescale*2,newvehicle.collisionheight*vehiclescale*2);
                newvehicle.bDrawDriverInTP = False;
                newvehicle.EntryRadius = newvehicle.default.EntryRadius * vehiclescale;
                onsvehicle(newvehicle).VehicleMass = onsvehicle(newvehicle).default.VehicleMass * vehiclescale;
                for (i = 0; i < onsvehicle(newvehicle).Weapons.Length  ; i++) {
                    onsvehicle(newvehicle).Weapons[i].SetDrawScale(vehiclescale);
                    onsvehicle(newvehicle).Weapons[i].SetDrawScale3D(drawscale3d);
                    Instigator.ClientMessage("weapons:"@onsvehicle(newvehicle).Weapons[i].GetHumanReadableName());
                }
                for (i = 0; i < onsvehicle(newvehicle).WeaponPawns.Length  ; i++) {
                    onsvehicle(newvehicle).WeaponPawns[i].SetDrawScale(vehiclescale);
                    onsvehicle(newvehicle).WeaponPawns[i].SetDrawScale3D(drawscale3d);
                    Instigator.ClientMessage("weaponpawns:"@onsvehicle(newvehicle).WeaponPawns[i].GetHumanReadableName());
                }
            }
    Thanks for any help.

    #2
    I remember we had an issue with this one time with resizing Pawns in the game, so the issue MAY be the same here.

    the way that we solved it was that we had to put something in the tick of the controller class like this:

    function Tick( float DeltaTime ) {
    drawToScale();

    Then the drawToScale() function was:
    Code:
    function DrawToScale()
    {
      local float myNum;
    
       myNum = 4.0;
    
       Pawn.SetDrawScale(myNum);
       Pawn.Weapon.SetDrawScale(myNum);
       if (self.bDuck==0)
          Pawn.SetCollisionSize(Pawn.Default.CollisionRadius * myNum, Pawn.Default.CollisionHeight * myNum);
       else
          Pawn.SetCollisionSize(Pawn.Default.CrouchRadius * myNum, Pawn.Default.CrouchHeight * myNum);
    }
    So it would constantly be resetting the collision radius, weapon draw scale, and draw scale for the pawn.

    I would be willing to bet if you had something in the tick that did the same kind of deal, it would work for your vehicle.

    Comment

    Working...
    X