Announcement

Collapse
No announcement yet.

Relative Physics Problem

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

  • replied
    In the line, "the magic happens here" :

    AR_ForceApplication = AR_UpwardsNormal * 0 + 5 * AR_NewRise * AR_ForwardsNormal;

    Specter, you mentioned that you were saving the 0 for a spaceship for later, can you elaborate on this? It would appear it is just to add more strength to the force?/ Not sure

    Leave a comment:


  • replied
    AirRaidKinematics should not need to be reliable server. The idea in MP is to just send the input across the network and have the client simulating what is happening on the server based on the input data sent. Of course some corrections happen, but these are not of our concern.

    The keyword server makes a function server side and reliable forces it to be called at 100 % probablity.

    Going into more details would keep me busy typing for the rest of the day. Instead I'll post links to good tutorials that teaches the basics of replication/coding network stuff.

    Tutorial:http://udkc.info/index.php?title=Tut...ight%27s_state

    A good introduction to replication is: http://wiki.beyondunreal.com/Everyth...raid_to_ask%29

    Afterwards you can take a full dive into all network related stuff about UDK here:
    http://udn.epicgames.com/Three/ReplicationHome.html

    I recommend to read the links in the order I posted them. ;-)

    Leave a comment:


  • replied
    Alien walk on surface
    Hi All,

    When aliens are walking on the surface,their legs going to down .....


    what the problem????


    kindly help me.....

    Leave a comment:


  • replied
    Alien walk on surface
    Hi All,

    When aliens are walking on the surface,their legs going to down .....


    what the problem????


    kindly help me.....

    Leave a comment:


  • replied
    Originally posted by VendorX View Post
    @Hiredicespecter: You don't need custom PlayerInput - exec functions will be called anyway and this have nothing to do with PlayerTick
    This is not about exec functions. Which the posted code does not use by the way.

    For playerTick not being called without a custom playerInput: see http://wiki.beyondunreal.com/UE3:UTP...%29#PlayerTick


    After reading that again, I guess if your controller extends from UTPlayerController it already has a playerInput. Or I needed it for multiplayer to work for some other custom input code. I didn't conducted tests as I needed a custom playerInput anyway.

    @marineuac: Do you use a custom playerInput class?

    Leave a comment:


  • replied
    Alien walk on surface
    Hi All,

    When aliens are walking on the surface,their legs going to down .....


    what the problem????


    kindly help me.....

    Leave a comment:


  • replied
    @Hiredicespecter: You don't need custom PlayerInput - exec functions will be called anyway and this have nothing to do with PlayerTick

    @marineuac: Put some log in SetInputs2 function...

    Leave a comment:


  • replied
    Originally posted by marineuac View Post
    but i could never get pitch and yaw to work via the mouse!
    I'll look into this during this weekend. My guess so far is that playerTick of your controller is not called, because you don't have a custom PlayerInput class (it can be empty). Have you verified it gets called by doing logging:
    Code:
    `log("Controller got called!")
    ?

    Leave a comment:


  • replied
    Alien walk on surface
    Hi All,

    When aliens are walking on the surface,their legs going to down .....


    what the problem????


    kindly help me.....

    Leave a comment:


  • replied
    Alien walk on surface
    Hi All,

    When aliens are walking on the surface,their legs going to down .....


    what the problem????


    kindly help me.....

    Leave a comment:


  • replied
    The code that belongs to the class AR_Aircraft previously posted here. I renamed it to SpaceShip in my post, because I felt it would be a better name.

    Leave a comment:


  • replied
    Alien walk on surface
    Hi All,

    When aliens are walking on the surface,their legs going to down .....


    what the problem????


    kindly help me.....

    Leave a comment:


  • replied
    Originally posted by 1Lt Coagulator View Post
    I know copy-paste is bad, and I think I already know the answer, but If I copy-pasted what you have here on this page, It still needs additional code (other pages back) in order to rotate correctly, right?
    Somewhat. The class names need to be adjusted in some cases and you have to merge the code for the ship. Quite close to copy and paste, but still needs a basic understanding of what you are doing.

    Leave a comment:


  • replied
    EDIT Oops double post

    Leave a comment:


  • replied
    Originally posted by Hiredicespecter View Post
    Sorry, my last post was really short. I was in a hurry.

    To elaborate:

    The rotation in UDK is done differently than applying the mouse input directly as force/torque to a ship. The rotation (the direction the player should face) is calculated by mouse movement, gamepad and others. The Controller gets a rotation and passes it to the pawn (a human model, a vehicle, etc. Something the player can move).

    Usually we would be able to use this rotation. The problem is that the rotation does not care about roll. On top of that Pitch/Tilt is treated like an unloved stepchild, because only the camera and the weapon orientation need it.

    This is why I wrote my own function SetInputs2, belonging to the ship, that passes the mouse input from the Controller to the ship directly. The ship rotation in the level is then used to set the rotation of controller so the radar is correctly orientated as well. Somewhat of a hack, but it works well.

    If you are familiar with the basics of multiplayer programming in UDK you can use SetInputs2 to send the input accross the network. But this is another topic, consider this just a hint for later. ;-)

    So what needs to be done, to get this to work, like I am currently doing it?

    You need your own game mode class, preferably deriving it from UTGame or UTDeathMatch. This way you can make UDK use your own controller. Most advanced coders will have done that already.

    Now to concrete code:

    The ship, called SpaceShip

    Code:
    Class SpaceShip extends UTVehicle;
    
    var vector input_turn;
    
    ...
    
    // own InputSet function, currently not used
    simulated function SetInputs2(float Yawing, float Pitching, float Rolling)
    {
    	input_turn.X = Rolling; // roll
    	input_turn.Y = Pitching; // pitch / tilt
    	input_turn.Z = Yawing; // yaw
    }
    
    simulated function AirRaidKinematics(float DeltaTime)
    {
          ...
    		// Roll
    		AR_ForceRotationVectX *= input_turn.X;
    
    		// Pitch
    		AR_ForceRotationVectY *= input_turn.Y;
    
    		// Yaw
    		AR_ForceRotationVectZ *= input_turn.Z;
    
    		// Add them together to get final global rotation vector:
    		AR_ForceRotation = AR_ForceRotationVectX + AR_ForceRotationVectY + AR_ForceRotationVectZ;
    }
    
    ...
    The controller, MyControllerPlayer

    Code:
    MyControllerPlayer extends UTPlayerController;
    
    // PlayerTick is only called if the PlayerController has a PlayerInput object. Therefore we need a dummy one
    event PlayerTick (float DeltaTime)
    {
           local SpaceShip ship;
    
    	super.PlayerTick(DeltaTime);
    
          ship = SpaceShip(pawn);
    
         // we are controlling a ship
         if(ship != null)
         {
                Ship.SetInputs2(PlayerInput.aMouseX / 20, -PlayerInput.aMouseY / 20, 0);
                // instead of 0 pass the value of the buttons you want use for roll
         }
    }
    
    // set the rotation of controller to that of the ship
    function ProcessViewRotation( float DeltaTime, out Rotator out_ViewRotation, Rotator DeltaRot )
    {
    	local SpaceShip Ship;
    	local Vector vec; // dummy var to satisfy GetSocketWorldLocation...
    
    	Ship = SpaceShip(Pawn);
    
    	if(Ship == none)
    		super.ProcessViewRotation( DeltaTime, out_ViewRotation, DeltaRot );
    	else
    	{
    		//get the location and rotation of the socket
    		Pawn.Mesh.GetSocketWorldLocationAndRotation(Ship.Seats[0].CameraTag, vec, out_ViewRotation);
    	}
    }
    
    DefaultProperties
    {
    }
    Code:
    // just a dummy, can serve as a central palce for exec functions
    class MyPlayerInput extends UTPlayerInput within MyControllerPlayer;
    
    exec function do Sth()
    {
    
    }
    
    DefaultProperties
    {
    }
    That's it, happy coding guys.

    ----------------------------------------------

    Important news:

    To get gravity for your plane/spaceship is really simple. I just figured it out. Extend from UTVehicle instead of UTAirVehicle.
    Then it won't use PHYS_FYLING anymore. Keep in mind that your vehicle must have a strong enough climbing force to get off the ground if you have the default gravity of -512.

    This seems somewhat strange, but makes sense as UTAirVehicle is supposed to implement a flying vehicle for a FPS, not a flight simulator.

    In conclusion we got a car which can fly. And has no wheels. ;-)

    I know copy-paste is bad, and I think I already know the answer, but If I copy-pasted what you have here on this page, It still needs additional code (other pages back) in order to rotate correctly, right?

    Leave a comment:

Working...
X