Page 2 of 4 FirstFirst 1234 LastLast
Results 41 to 80 of 153
  1. #41
    Banned
    Join Date
    Aug 2011
    Posts
    311

    Default

    Quote Originally Posted by Hiredicespecter View Post
    You mean that nothing changes after you have changed the code in the way I suggested?
    Can you help me please.

  2. #42
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    Replace the 5 with a 50. This might help if it is a problem with gravity or damping. 5 would move the Cicada with walking speed, 50 is more than running.

    On top of that let's rule out input as the problem.
    I hope you are familiar with logging. Please add
    Code:
     `log("Rise: "$AR_NewRise);
    under
    Code:
     // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 50 * AR_ForwardsNormal;
    Now pay attention how the numbers spammed into your log change, when your are in the Cicada and press jump or crouch. If you press jump it should be 1, if you press crouching it should be -1.

    [EDIT]: There is no need to post something like "Please help" after you have posted to a thread. Everybody that is activly following the thread, like me, will get a mail notification, already after the first post.
    Give people, especially me, at least 48 hours before posting stuff like this, because I can't always respond within 2 hours, since I am in a different time zone than you and have a busy life.
    Last edited by Hiredicespecter; 10-06-2013 at 10:19 AM.

  3. #43
    Banned
    Join Date
    Aug 2011
    Posts
    311

    Default

    No difference and I am clueless when it comes to logging.
    Forgetting the Ar_Aircraft script lets move onto the default Cicada script.

    Hiredicespecter, could you tell me what to modify in the Cicada script to get it near enough to fly like a plane?

    Thanks.

  4. #44
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    There is no way to simply modify the Cicada script and make the Cicada fly like a plane.
    The Cicada is a helicopter and the UT code doesn't offer a way to change that.
    That's what the AR_Aircraft script is for. It adds custom forces to change the physical behavior of the Cicada. I changed its behavior to that of a spaceship, but a plane is doable as well.

    The changes needed to archive a plane/spaceship like behavior have been posted by me before.

    We need to locate the problem and afterwards it can be easily changed from a crappy spaceship to a simple plane.

    For locating the problem, I assume there is something wrong with your level, proably gravity. Have you placed the Cicada in a large gravity volume with gravity set to 0?

    If that fails as well, there is no choice but to log. Don't worry that is very simple. And you will need it anyway, if you continue with UDK to figure out further (non script) errors.

  5. #45
    God King
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    4,400
    Gamer IDs

    Gamertag: tegleg digital

    Default

    wow this is pretty mental.
    works for me, thanks for sharing.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: NEW! Tegs Playground Multiplayer Edition
    Unwheel2 - VCTF Game - Sponic Mesh 3D
    Shh.. dont tell anyone about my android apps.
    will code for money

  6. #46
    Banned
    Join Date
    Aug 2011
    Posts
    311

    Default

    What should I do any suggestions? This sucks.

  7. #47
    Banned
    Join Date
    Aug 2011
    Posts
    311

    Default

    Quote Originally Posted by tegleg View Post
    wow this is pretty mental.
    works for me, thanks for sharing.
    Hey TegLeg Could you post your content.uc code here as I am having trouble getting this to work.

    Thanks

  8. #48
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    @GentlemenGraphics: You seem to misunderstand the function of the content class. Its sole purpose is to customise the appereance of the vehicle, nothing else.
    The problem appears to be related to your level or your global settings. So what gravity is set in your level?

    @tegleg: Thanks, glad to know that it works for others as well. Did you fly the vehicle in UDK's default gravity?
    Last edited by Hiredicespecter; 10-08-2011 at 11:14 AM.

  9. #49
    Banned
    Join Date
    Aug 2011
    Posts
    311

    Default

    Quote Originally Posted by Hiredicespecter View Post
    @GentlemenGraphics: You seem to misunderstand the function of the content class. Its sole purpose is to customise the appereance of the vehicle, nothing else.
    The problem appears to be related to your level or your global settings. So what gravity is set in your level?

    @tegleg: Thanks, glad to know that it works for others as well. Did you fly the vehicle in UDK's default gravity?
    I have gravity set to default in my level and I have used a gravity volume set to 0 but still no luck.

    More help needed.

  10. #50
    God King
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    4,400
    Gamer IDs

    Gamertag: tegleg digital

    Default

    yes just in default gravity.
    it would take quite a bit of work to get it flying like an aeroplane but its fun to fly as it is. some kind of anti-gravity vehicle

    @GentlemenGraphics
    you need to start reading what people say and not just blindly copy/paste
    again, change this line to make it move forwards. '50' is the speed it will go
    Code:
    // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 50 * AR_ForwardsNormal;
    all i did was copy cicada_content and made it extend AR_Aircraft so theres no point in posting my code, you already have it.
    Last edited by tegleg; 10-08-2011 at 04:44 PM.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: NEW! Tegs Playground Multiplayer Edition
    Unwheel2 - VCTF Game - Sponic Mesh 3D
    Shh.. dont tell anyone about my android apps.
    will code for money

  11. #51
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    @GentlemenGraphics:

    The things I could thing of appear to be not be source of your problem. As tegleg and myself got it working right away, there must a problem on your end. Since the code is fine, there are only two options left.
    1. Debuging with logging. It will be take a lot of time and I can't promise you it will work in the end, but it has alwayas helped me.
    2. Backup your work, reinstall UDK and add the code again. If it doesn't work after a clean install with no other changes, I have absolutly no idea what's going on on your end. This measure is extreme, but if you have changed litte until now, it might be worth a try.

    I recommend option 1, but it is up to you.

    @tegleg: Do you intend to make a plane? As far as I see it, a plane in an arcade game should be very simple, just like hawx. You must NOT think the way physics work in reality, but how you need to apply forces to get what you want. Basicly fake and cheat all the way.^^
    If you want to realize a simple plane, I will tell you my ideas on the physics concept I have in mind. I am just not into realizing it myself right now.
    Last edited by Hiredicespecter; 10-08-2011 at 05:12 PM.

  12. #52
    God King
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    4,400
    Gamer IDs

    Gamertag: tegleg digital

    Default

    ive got no plans to make a plane with this, i just stumbled upon the thread and tried it out, and its good. ill probably mess around with it and make a few aircraft with it though.
    ive got another plane that has a very arcade feel but it wont loop so maybe ill merge the 2 somehow. no i wont give you it GentlemenGraphics as its a wip and would take too much explaining, sorry.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: NEW! Tegs Playground Multiplayer Edition
    Unwheel2 - VCTF Game - Sponic Mesh 3D
    Shh.. dont tell anyone about my android apps.
    will code for money

  13. #53
    Banned
    Join Date
    Aug 2011
    Posts
    311

    Thumbs down

    Quote Originally Posted by tegleg View Post
    yes just in default gravity.
    it would take quite a bit of work to get it flying like an aeroplane but its fun to fly as it is. some kind of anti-gravity vehicle

    @GentlemenGraphics
    you need to start reading what people say and not just blindly copy/paste
    again, change this line to make it move forwards. '50' is the speed it will go
    Code:
    // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 50 * AR_ForwardsNormal;
    all i did was copy cicada_content and made it extend AR_Aircraft so theres no point in posting my code, you already have it.
    When I copied and pasted the Cicada_Content.uc code and after extending it to AR_Aircraft I tried to compile it but it gave me errors such as "jetcontrol" unrecognizable or something similar. So I removed alot of the Cidcada_Content.uc code which leads me to think it is that which is at fault.

    What do you think could it be the content code?

  14. #54
    God King
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    4,400
    Gamer IDs

    Gamertag: tegleg digital

    Default

    ah yes delete that bit about jetcontrol and it should be good to go.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: NEW! Tegs Playground Multiplayer Edition
    Unwheel2 - VCTF Game - Sponic Mesh 3D
    Shh.. dont tell anyone about my android apps.
    will code for money

  15. #55
    Skaarj
    Join Date
    Jan 2008
    Location
    Denmark
    Posts
    20

    Default

    Hallo

    I've used your code and I got this out of it. I have tried for months on/off to get it to work, but finally I got it working. thanks.

    Some questions:
    controls Steering, Throttle and Rise are set by the controller - but Where. I missing a Pitch and boost. ?
    Throttle, I can not control it is on all the time - how do I control it. ?
    Gravity is very poor - how can I change it. ?

    A little movie I made of my process:
    UDK spaceship test controlls
    Last edited by KongWeezY; 10-09-2011 at 12:13 PM.

  16. #56
    God King
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    4,400
    Gamer IDs

    Gamertag: tegleg digital

    Default

    still trying to tame the controlls myself.

    it moves forward all the time because of the '50' in this line
    Code:
     // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 50 * AR_ForwardsNormal;
    you would have to change this value by pressing a buton.

    PlayerInput and its various extensions along with the PlayerController is where controlls are handled.
    DefaulInput.ini has the key bindings.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: NEW! Tegs Playground Multiplayer Edition
    Unwheel2 - VCTF Game - Sponic Mesh 3D
    Shh.. dont tell anyone about my android apps.
    will code for money

  17. #57
    Skaarj
    Join Date
    Jan 2008
    Location
    Denmark
    Posts
    20

    Default

    PZ_ForceApplication = PZ_UpwardsNormal * 0 + 1500 * Throttle * PZ_ForwardsNormal;
    this is now controll by "W" and "S"


    Forward:
    Throttle by default settings is "W" and "S"

    Yaw:
    Steering by default settings is "right" and "left" I have change it to A and D

    Roll:
    Rise by default settings is "space" and "c" I have change it to Q and E

    Pitch, where is non. - how do I add it.


    I missed one controll... how do I add it.



    In UTVehicle
    simulated function SetInputs(float InForward, float InStrafe, float InUp)
    {
    local bool bReverseThrottle;
    local UTConsolePlayerController ConsolePC;
    local rotator SteerRot, VehicleRot;
    local vector SteerDir, VehicleDir, AngVel;
    local float VehicleHeading, SteerHeading, DeltaTargetHeading, Deflection;

    Throttle = InForward;
    Steering = InStrafe;
    Rise = InUp;
    Pitch = InJump;


    ConsolePC = UTConsolePlayerController(Controller);
    if (ConsolePC != None)
    ......

    I have tried to add it here, but it does not work....

  18. #58
    God King
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    4,400
    Gamer IDs

    Gamertag: tegleg digital

    Default

    just been playing around with this, you can use these to get the player input.

    PlayerController(Controller).PlayerInput.RawJoyLoo kUp
    PlayerController(Controller).PlayerInput.RawJoyLoo kRight
    PlayerController(Controller).PlayerInput.RawJoyRig ht
    PlayerController(Controller).PlayerInput.RawJoyUp

    vehicle controlls have been spazzed in PlayerController - state PlayerDriving - ProcessDrive()
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: NEW! Tegs Playground Multiplayer Edition
    Unwheel2 - VCTF Game - Sponic Mesh 3D
    Shh.. dont tell anyone about my android apps.
    will code for money

  19. #59
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    I had my fun with adding additional controls for vehicles as well. Getting them to work in single player only is very simple, tegleg qutlined how to.
    If you want the controls in multiplayer, it is possible, but not easy. Or I missed something.^^

    [EDIT]:
    Pitch = InJump;
    That won't work, because there is no parameter named InJump. The input for jumping and crouching is already stored in InUp. There is no point in modifying SetInput.
    Last edited by Hiredicespecter; 10-10-2011 at 03:49 AM.

  20. #60
    God King
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    4,400
    Gamer IDs

    Gamertag: tegleg digital

    Default

    have you tried this?

    Pitch = PlayerController(Controller).PlayerInput.Jump;

    or
    PlayerController(Controller).PlayerInput.bXAxis
    PlayerController(Controller).PlayerInput.bYAxis

    or PlayerController(Controller).PlayerInput. any one of these
    aBaseX;
    aBaseY;
    aBaseZ;
    aMouseX;
    aMouseY;
    aForward;
    aTurn;
    aStrafe;
    bStrafe
    aUp;
    aLookUp;
    aRightAnalogTrigger;
    aLeftAnalogTrigger;
    Last edited by tegleg; 10-10-2011 at 04:21 AM.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: NEW! Tegs Playground Multiplayer Edition
    Unwheel2 - VCTF Game - Sponic Mesh 3D
    Shh.. dont tell anyone about my android apps.
    will code for money

  21. #61
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    @KongWeezY: Do you want to use existing controls for your vehicle, e.g. "Feign Death" should act as boost for your vehicle. Or do you want to define new key functions that don't have an effect outside of the vehicle?

  22. #62
    Skaarj
    Join Date
    Jan 2008
    Location
    Denmark
    Posts
    20

    Default

    I won't to add a extra key.

    now I have Throttle(keys"W"-"S), Steering(left and right arrows) and Rise(space and Ctrl) ---- Default keys

    // Roll
    // No rolling for now, I will use q and e for the forward movement for the time being
    PZ_ForceRotationVectX *= 800 * Rise; // PZ_NewRise is between -1 and 1

    // Pitch
    PZ_ForceRotationVectY *= 30 * Throttle; // Throttle is between -1 and 1

    // Yaw
    PZ_ForceRotationVectZ *= 30 * -Steering; // Steering is between -1 and 1

    // The magic happens here ---- Forward
    PZ_ForceApplication = PZ_ForwardsNormal * 6000; I need a key here to control move forward and stop

    hope you can help me. I have tried many things to get it to work


    I have make me own spaceship In blender. 15 minutes of work. I will share the work, when it finished.
    If you have a cool concept or design of a spaceship, I can great it.
    some pictures



  23. #63
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    I suggest that you use the mouse for turning to free keys. The following code will ONLY work in single player.

    Code:
    // Roll
    PZ_ForceRotationVectX *= 800 * Rise; // PZ_NewRise is between -1 and 1
    
    // Pitch
    PZ_ForceRotationVectY *= 30 * -PlayerController(Controller).PlayerInput.aMouseY / 100;
    
    // Yaw
    PZ_ForceRotationVectZ *= 30 * PlayerController(Controller).PlayerInput.aMouseX / 100;
    
    // The magic happens here ---- Forward
    PZ_ForceApplication = PZ_ForwardsNormal * Throttle * 6000;
    This plane will turn with the mouse.
    You will have to keep W pressed to move forward.

    You might try instead:
    Code:
    PZ_ForceApplication = PZ_ForwardsNormal * (Throttle+1) * 6000;
    This should result in a default forward movement, W acts as an afterbruner, A as brakes. Similiar to Ubisoft's HAWX.

    Since Steering is unused now, you might want to add strafing.
    Last edited by Hiredicespecter; 10-12-2011 at 12:51 PM.

  24. #64
    Skaarj
    Join Date
    Jan 2008
    Location
    Denmark
    Posts
    20

    Default

    I do not know what I'm doing wrong, but it does not work ... I have tried and bind buttons

    Bindings = (Name = "MouseX", Command = "Count bYAxis | Axis aMouseX")
    Bindings = (Name = "MouseY", Command = "Count bYAxis | Axis aMouseY")


    // Pitch
    PZ_ForceRotationVectY *= 30 * -PlayerController(Controller).PlayerInput.aMouseY / 100;

    // Yaw
    PZ_ForceRotationVectZ *= 30 * PlayerController(Controller).PlayerInput.aMouseX / 100;

    the debugging, does not fail, but nothing happens, when I use the mouse...




    Nice code..
    PZ_ForceApplication = PZ_ForwardsNormal * (Throttle+1) * 6000;

  25. #65
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    I haven't binded the MouseX/MouseY in my DefaultInput.ini at all. They are binded by default as far as I know.

    By the way there is a small mistakte in the bindings you posted:

    Bindings = (Name = "MouseX", Command = "Count bYAxis | Axis aMouseX")
    Bindings = (Name = "MouseY", Command = "Count bYAxis | Axis aMouseY")

    should be

    Bindings = (Name = "MouseX", Command = "Count bXAxis | Axis aMouseX")
    Bindings = (Name = "MouseY", Command = "Count bYAxis | Axis aMouseY")

    If removing the bindings from the DefaultInput.ini (if they are even there, don't remove them from UDKInput.ini) doesn't help, try logging to figure out the mistake.

    On top of that you might try to remove the "/100". The calculated values might be just to small.^^

    Code:
    // Pitch
    PZ_ForceRotationVectY *= 30 * -PlayerController(Controller).PlayerInput.aMouseY;
    
    // Yaw
    PZ_ForceRotationVectZ *= 30 * PlayerController(Controller).PlayerInput.aMouseX;
    
    `log("MOUSEX: "$PlayerController(Controller).PlayerInput.aMouseX);
    `log("MOUSEY: "$PlayerController(Controller).PlayerInput.aMouseY);
    If the values in your logging window are all 0 when you are moving the mouse, you are in trouble.^^
    If it works, remove the `log.


    [EDIT] Although you said spaceship, don't you mean plane? Because you asked how to fix/add gravity to the spacehsip. Spaceships aren't affected by earth's gravity since they are in space^^

    For a plane I would recommend a key layout as following:

    Roll with A/D (Steering),
    Pitch with W/S (Throttle),
    Forward/backward: Space/C (AR_NewRise) and a default forward speed

    Code:
    // Roll
    PZ_ForceRotationVectX *= 30* Steering; // you might want to play with 30
    
    // Pitch
    PZ_ForceRotationVectY *= 30 * Throttle;
    
    // No Yaw turning, planes turn mostly by a combination of roll and pitch, so let's ignore it for now
    PZ_ForceRotationVectZ *= 0;
    
    // The magic happens here ---- Forward
    PZ_ForceApplication = PZ_ForwardsNormal * (AR_NewRise+1)* 6000;
    This would result in a nice plane, that still isn't affected by gravity. If you want gravity, you have to consider (air) lift and drag forces as well. I can go into that after we have figured out your input issue.
    Last edited by Hiredicespecter; 10-16-2011 at 04:35 AM.

  26. #66

    Default

    Hey, I wanted to say a big thanks to those sharing their scripting knowledge in this thread, it's been a massive help for an unrealscript noob like me experimenting with vehicle controls. Out of curiosity: has anyone had any luck playing around with getting "lookSteer" similar to that on the Cicada working on both the vehicle's Yaw and the vehicle's Pitch? I've been struggling with this for a few days now, and the best I've managed was having the vehicle spinning on the spot nose down. :P

  27. #67
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    Please give me a short description of what lookSteer does/you want to archieve. I haven't used it, since I haven't bothered much with default vehicle controls. They are simply not meant to be used for a space/flight vehicle.

  28. #68

    Default

    Sure, thanks I figured it wouldn't be as easy as copying one of their vehicle scripts, thought it would be a good start though to see how things are done though.

    With the Cicada and Manta the vehicle's strafing and throttle are controlled with the keyboard while the player can freely look around using the mouse, with the vehicle's yaw following the camera view, slightly lagging behind. I've recorded a quick video of the Cicada here:


    I'm looking for a similar effect but with the vehicle's pitch as well. After some digging around I've found the following input code with something relevant to the LookSteer in the UTVehicle.uc, I might tinker about with it a bit and see what happens.

    Code:
    simulated function SetInputs(float InForward, float InStrafe, float InUp)
    {
    	local bool bReverseThrottle;
    	local UTConsolePlayerController ConsolePC;
    	local rotator SteerRot, VehicleRot;
    	local vector SteerDir, VehicleDir, AngVel;
    	local float VehicleHeading, SteerHeading, DeltaTargetHeading, Deflection;
    
    	Throttle = InForward;
    	Steering = InStrafe;
    	Rise = InUp;
    
    	ConsolePC = UTConsolePlayerController(Controller);
    	if (ConsolePC != None)
    	{
    		Steering = FClamp(Steering * ConsoleSteerScale, -1.0, 1.0);
    
    		UpdateLookSteerStatus();
    
    		// tank, wheeled / heavy vehicles will use this
    
    		// If we desire 'look steering' on this vehicle, do it here.
    		if (bUsingLookSteer && IsHumanControlled())
    		{
    			// If there is a deflection, look at the angle that its point in.
    			Deflection = Sqrt(Throttle*Throttle + Steering*Steering);
    
    			if(bStickDeflectionThrottle)
    			{
    				// The region we consider 'reverse' is anything below DeflectionReverseThresh, or anything withing the triangle below the center position.
    				bReverseThrottle = ((Throttle < DeflectionReverseThresh) || (Throttle < 0.0 && Abs(Steering) < -Throttle));
    				Throttle = Deflection;
    
    				if (bReverseThrottle)
    				{
    					Throttle *= -1;
    				}
    			}
    
    			VehicleRot.Yaw = Rotation.Yaw;
    			VehicleDir = vector(VehicleRot);
    
    			SteerRot.Yaw = DriverViewYaw;
    			SteerDir = vector(SteerRot);
    
    			VehicleHeading = GetHeadingAngle(VehicleDir);
    			SteerHeading = GetHeadingAngle(SteerDir);
    			DeltaTargetHeading = FindDeltaAngle(SteerHeading, VehicleHeading);
    
    			if (DeltaTargetHeading > LookSteerDeadZone)
    			{
    				Steering = FMin((DeltaTargetHeading - LookSteerDeadZone) * LookSteerSensitivity, 1.0);
    			}
    			else if (DeltaTargetHeading < -LookSteerDeadZone)
    			{
    				Steering = FMax((DeltaTargetHeading + LookSteerDeadZone) * LookSteerSensitivity, -1.0);
    			}
    			else
    			{
    				Steering = 0.0;
    			}
    
    			AngVel = Mesh.BodyInstance.GetUnrealWorldAngularVelocity();
    
    			Steering = FClamp(Steering + (AngVel.Z * LookSteerDamping), -1.0, 1.0);
    
    			// Reverse steering when reversing
    			if (Throttle < 0.0 && ForwardVel < 0.0)
    			{
    				Steering = -1.0 * Steering;
    			}
    		}
    		// flying hovering vehicles will use this
    		else
    		{
    			//`log( " flying hovering vehicle" );
    			if (bStickDeflectionThrottle)
    			{
    				// The region we consider 'reverse' is anything below DeflectionReverseThresh, or anything withing the triangle below the center position.
    				bReverseThrottle = ((Throttle < DeflectionReverseThresh) || (Throttle < 0.0 && Abs(Steering) < -Throttle));
    
    				Deflection = Sqrt(Throttle*Throttle + Steering*Steering);
    				Throttle = Deflection;
    
    				if (bReverseThrottle)
    				{
    					Throttle *= -1;
    				}
    			}
    		}
    
    		//`log( "Throttle: " $ Throttle $ " Steering: " $ Steering );
    	}
    }

  29. #69
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    I see what you want to do. The problem is as following:

    The whole UT-Code shipped with UDK is designed for a classic FPS. Meaning features like planes flying upside down or tilting a vehicle were not considered to be needed during development, because 99 % of FPSs do not need such features and those make the code a lot more complex.
    In conclusion there is no easy way of achieving what you are after. It is possible, about medium difficultiy, but you have to code EVERYTHING yourself. Including the lockSteer for Yaw and Pitch, because the UT-Code considers only yaw rotation as valid player input and is basicly impossible to extend/modify. On top of that you have to understand how forces are used to move the cicada the way you want to. Don't forget vector math.
    But don't let me stop you, just be aware that it is not an easy task for a beginner and will take some time. Go ahead and make something epic. ;-)
    Last edited by Hiredicespecter; 12-30-2011 at 02:36 PM.

  30. #70

    Default

    Haha, I was afraid of that, interesting about not taking pitch into consideration. I'll focus on what I can do with the design and art side of things for now, thanks.

  31. #71

    Default

    Wow firstly, thanks to everyone in this thread, I have managed to get it in my game and 'semi-working' however it appears to turn very very slowly (whether using W,S or A,D), Space and C affect the speed quite fast, Ill add in all my code now if someone could quickly peruse it

    I did have my own custom models and everything in there but they were causing more problems than solving so following what others said in here, I swapped over to referencing the Cicada in the code.

    UTVehicle_PulseTest2.uc (AR_Aircraft.uc)

    Code:
    class UTVehicle_PulseTest2 extends UTAirVehicle;
    
    /* etc */
    
    var float AR_MaxLift, AR_TurnSpeed, AR_Speed, AR_CurrentForward, 
    
    AR_AddedLiftSpeed, AR_Acceleration;
    
    /* etc */
    
    simulated function AirRaidKinematics(float DeltaTime)
    {
    local Vector AR_ForceApplication, AR_ForceRotation, AR_ForwardsNormal, 
    
    AR_UpwardsNormal, AR_SidewardsNormal;
    local Vector AR_ForceRotationVectX, AR_ForceRotationVectY, 
    
    AR_ForceRotationVectZ;
    local float AR_NewRise;
    
    // While there is a player in the biplane:
    if (PlayerController(Controller) != None)
    {
    GetAxes(Rotation, AR_ForwardsNormal, AR_SidewardsNormal, 
    
    AR_UpwardsNormal);
    
    // It's probably unnecessary to normalise these:
    AR_ForceRotationVectX = Normal(AR_ForwardsNormal);
    AR_ForceRotationVectY = Normal(AR_SidewardsNormal);
    AR_ForceRotationVectZ = Normal(AR_UpwardsNormal);
    
    // Rise is NOT between -1 and 1, like it said it was
    AR_NewRise = 0;
    if (Rise != 0) AR_NewRise = Rise / Abs(Rise); // Avoid divide by 0
    
    // Calculate the XYZ components of the relative steering:
    // Generic controls Steering, Throttle and Rise are set by the controller
    
    // Roll
    // No rolling for now, I will use q and e for the forward movement for 
    
    the time being
    // AR_ForceRotationVectX *= 35 * -AR_NewRise; // AR_NewRise is between -1 
    
    and 1
    
    // Pitch
    AR_ForceRotationVectY *= 30 * Throttle; // Throttle is between -1 and 1
    
    // Yaw
    AR_ForceRotationVectZ *= 25 * -Steering; // Steering is between -1 and 1
    
    // Add them together to get final global rotation vector:
    AR_ForceRotation = AR_ForceRotationVectX + AR_ForceRotationVectY + 
    
    AR_ForceRotationVectZ;
    
    // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 50 * AR_NewRise * 
    
    AR_ForwardsNormal;
    
    // Add forces and rotations
    Mesh.AddForce(AR_ForceApplication);
    Mesh.AddTorque(AR_ForceRotation);
    }
    else
    {
    // if nobody is in the plane, don't apply forces to it, do nothing
    }
    }
    
    
    simulated function Tick(float DeltaTime)
    {
    AirRaidKinematics(DeltaTime);
    Super.Tick(DeltaTime);
    }
    
    /* etc */
    UTVehicleFactor_PulseTest2

    Code:
    class UTVehicleFactory_PulseTest2 extends UTVehicleFactory placeable;
    
    defaultproperties
    {
    	Begin Object Name=SVehicleMesh
    		SkeletalMesh=SkeletalMesh'VH_Cicada.Mesh.SK_VH_Cicada'
    		Translation=(X=-40.0,Y=0.0,Z=-70.0)
    	End Object
    
    
    	Begin Object Name=CollisionCylinder
    		CollisionHeight=+120.0
    		CollisionRadius=+200.0
    		Translation=(X=0.0,Y=0.0,Z=-40.0)
    	End Object
    
    	VehicleClassPath="UTGameContent.UTVehicle_PulseTest_Content2"
    	DrawScale=1
    }
    UT_Vehicle_PulseTest_Content2.uc

    Code:
    class UTVehicle_PulseTest_Content2 extends UTVehicle_PulseTest2;
    
    var array<UTDecoy> Decoys;
    
    simulated function PostBeginPlay()
    {
    	Super.PostBeginPlay();
    }
    
    function IncomingMissile(Projectile P)
    {
    	local UTVWeap_CicadaTurret Turret;
    
    	// notify the turret weapon
    	if (Seats.length > 1)
    	{
    		Turret = UTVWeap_CicadaTurret(Seats[1].Gun);
    		if (Turret != None)
    		{
    			Turret.IncomingMissile(P);
    		}
    	}
    
    	Super.IncomingMissile(P);
    }
    
    defaultproperties
    {
    	Begin Object Name=CollisionCylinder
    		CollisionHeight=+70.0
    		CollisionRadius=+240.0
    		Translation=(X=-40.0,Y=0.0,Z=40.0)
    	End Object
    
    	Begin Object Name=SVehicleMesh
    		SkeletalMesh=SkeletalMesh'VH_Cicada.Mesh.SK_VH_Cicada'
    		AnimTreeTemplate=AnimTree'VH_Cicada.Anims.AT_VH_Cicada'
    		
    
    PhysicsAsset=PhysicsAsset'VH_Cicada.Mesh.SK_VH_Cicada_Physics'
    		AnimSets.Add(AnimSet'VH_Cicada.Anims.VH_Cicada_Anims')
    	End Object
    
    	DrawScale=1.3
    
    	Health=500
    	BigExplosionTemplates[0]=
    
    (Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Far',Min
    
    Distance=350)
    	BigExplosionTemplates[1]=
    
    (Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Near')
    	BigExplosionSocket=VH_Death
    
    	Seats.Empty
    	Seats(0)={(	GunClass=class'UTVWeap_CicadaMissileLauncher',
    				GunSocket=(Gun_Socket_02,Gun_Socket_01),
    				CameraTag=ViewSocket,
    				TurretControls=(LauncherA,LauncherB),
    				CameraOffset=-400,
    				CameraBaseOffset=(Z=25.0),
    				SeatIconPos=(X=0.48,Y=0.25),
    				GunPivotPoints=(Main),
    				WeaponEffects=
    
    ((SocketName=Gun_Socket_01,Offset=(X=-80),Scale3D=
    
    (X=12.0,Y=15.0,Z=15.0)),(SocketName=Gun_Socket_02,Offset=(X=-
    
    80),Scale3D=(X=12.0,Y=15.0,Z=15.0)))
    				)}
    
    	Seats(1)={(	GunClass=class'UTVWeap_CicadaTurret',
    				GunSocket=
    
    (Turret_Gun_Socket_01,Turret_Gun_Socket_02,Turret_Gun_Socket_03,Turret_Gu
    
    n_Socket_04),
    				TurretVarPrefix="Turret",
    				TurretControls=(Turret_Rotate),
    				CameraTag=Turret_ViewSocket,
    				CameraOffset=0,
    				GunPivotPoints=(MainTurret_Pitch),
    				CameraEyeHeight=0,
    				SeatIconPos=(X=0.48,Y=0.56),
    				ViewPitchMin=-14000.0,
    				ViewPitchMax=1.0,
    				WeaponEffects=
    
    ((SocketName=Turret_Gun_Socket_04,Offset=(X=-80),Scale3D=
    
    (X=8.0,Y=10.0,Z=10.0)),(SocketName=Turret_Gun_Socket_03,Offset=(X=-
    
    80),Scale3D=(X=8.0,Y=10.0,Z=10.0)))
    				)}
    
    
    	
    
    TurretBeamTemplate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndPrim_B
    
    eam'
    
    	VehicleEffects.Empty
    	
    	VehicleEffects(0)=
    
    (EffectStartTag=TurretWeapon00,EffectEndTag=STOP_TurretWeapon00,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_01)
    	VehicleEffects(1)=
    
    (EffectStartTag=TurretWeapon01,EffectEndTag=STOP_TurretWeapon01,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_02)
    	VehicleEffects(2)=
    
    (EffectStartTag=TurretWeapon02,EffectEndTag=STOP_TurretWeapon02,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_03)
    	VehicleEffects(3)=
    
    (EffectStartTag=TurretWeapon03,EffectEndTag=STOP_TurretWeapon03,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_04)
    
    	VehicleEffects(4)=
    
    (EffectStartTag=EngineStart,EffectEndTag=EngineStop,EffectTemplate=Partic
    
    leSystem'VH_Cicada.Effects.P_VH_Cicada_GroundEffect',EffectSocket=GroundE
    
    ffectBase)
    	VehicleEffects(5)=
    
    (EffectStartTag=EngineStart,EffectEndTag=EngineStop,EffectTemplate=Partic
    
    leSystem'VH_Cicada.Effects.P_VH_Cicada_Exhaust',EffectSocket=LeftExhaust)
    	VehicleEffects(6)=
    
    (EffectStartTag=EngineStart,EffectEndTag=EngineStop,EffectTemplate=Partic
    
    leSystem'VH_Cicada.Effects.P_VH_Cicada_Exhaust',EffectSocket=RightExhaust
    
    )
    	VehicleEffects(7)=
    
    (EffectStartTag=DamageSmoke,EffectEndTag=NoDamageSmoke,bRestartRunning=fa
    
    lse,EffectTemplate=ParticleSystem'Envy_Effects.Vehicle_Damage.P_Vehicle_D
    
    amage_1_Cicada',EffectSocket=DamageSmoke_01)
    
    	VehicleAnims(0)=(AnimTag=Created,AnimSeqs=
    
    (InActiveStill),AnimRate=1.0,bAnimLoopLastSeq=false,AnimPlayerName=Cicada
    
    Player)
    	VehicleAnims(1)=(AnimTag=EngineStart,AnimSeqs=
    
    (GetIn),AnimRate=1.0,bAnimLoopLastSeq=false,AnimPlayerName=CicadaPlayer)
    	VehicleAnims(2)=(AnimTag=Idle,AnimSeqs=
    
    (Idle),AnimRate=1.0,bAnimLoopLastSeq=true,AnimPlayerName=CicadaPlayer)
    	VehicleAnims(3)=(AnimTag=EngineStop,AnimSeqs=
    
    (GetOut),AnimRate=1.0,bAnimLoopLastSeq=false,AnimPlayerName=CicadaPlayer)
    
    	JetEffectIndices=(11,12)
    	ContrailEffectIndices=(2,3,4,5,13,14)
    	GroundEffectIndices=(10)
    
    	// Sounds
    	// Engine sound.
    	Begin Object Class=AudioComponent Name=RaptorEngineSound
    		
    
    SoundCue=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_EngineLoop'
    	End Object
    	EngineSound=RaptorEngineSound
    	Components.Add(RaptorEngineSound);
    
    	
    
    CollisionSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Colli
    
    de'
    	
    
    EnterVehicleSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_St
    
    art'
    	
    
    ExitVehicleSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Sto
    
    p'
    
    	// Scrape sound.
    	Begin Object Class=AudioComponent Name=BaseScrapeSound
    		
    
    SoundCue=SoundCue'A_Gameplay.A_Gameplay_Onslaught_MetalScrape01Cue'
    	End Object
    	ScrapeSound=BaseScrapeSound
    	Components.Add(BaseScrapeSound);
    
    	// Initialize sound parameters.
    	EngineStartOffsetSecs=2.0
    	EngineStopOffsetSecs=1.0
    
    	IconCoords=(U=988,V=0,UL=33,VL=42)
    
    	
    
    ExplosionSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Explo
    
    de'
    	JetScalingParam=JetScale
    
    	PassengerTeamBeaconOffset=(X=-125.0f,Y=0.0f,Z=-105.0f);
    	
    
    ReferenceMovementMesh=StaticMesh'Envy_Effects.Mesh.S_Air_Wind_Ball'
    
    	HudCoords=(U=106,V=125,UL=-106,VL=124)
    	TeamMaterials[0]
    
    =MaterialInstanceConstant'VH_Cicada.Materials.MI_VH_Cicada_Red'
    	TeamMaterials[1]
    
    =MaterialInstanceConstant'VH_Cicada.Materials.MI_VH_Cicada_Blue'
    
    	BurnOutMaterial[0]
    
    =MaterialInterface'VH_Cicada.Materials.MITV_VH_Cicada_Red_BO'
    	BurnOutMaterial[1]
    
    =MaterialInterface'VH_Cicada.Materials.MITV_VH_Cicada_Blue_BO'
    
    	SpawnMaterialLists[0]=(Materials=
    
    (MaterialInterface'VH_Cicada.Materials.MI_VH_Cicada_Spawn_Red'))
    	SpawnMaterialLists[1]=(Materials=
    
    (MaterialInterface'VH_Cicada.Materials.MI_VH_Cicada_Spawn_Blue'))
    
    	DamageMorphTargets(0)=
    
    (InfluenceBone=Lt_Gun_Yaw,MorphNodeName=none,Health=150,DamagePropNames=
    
    (Damage2))
    	DamageMorphTargets(1)=
    
    (InfluenceBone=Rt_Gun_Yaw,MorphNodeName=none,Health=150,DamagePropNames=
    
    (Damage2))
    	DamageMorphTargets(2)=
    
    (InfluenceBone=FrontGuardDamage,MorphNodeName=none,Health=150,DamagePropN
    
    ames=(Damage1))
    	DamageMorphTargets(3)=
    
    (InfluenceBone=MainTurret_Yaw,MorphNodeName=none,Health=150,DamagePropNam
    
    es=(Damage3))
    
    	DamageParamScaleLevels(0)=(DamageParamName=Damage1,Scale=3)
    	DamageParamScaleLevels(1)=(DamageParamName=Damage2,Scale=1.5)
    	DamageParamScaleLevels(2)=(DamageParamName=Damage3,Scale=2.5)
    
    	
    
    DrivingPhysicalMaterial=PhysicalMaterial'VH_Cicada.materials.physmat_Cica
    
    da_driving'
    	
    
    DefaultPhysicalMaterial=PhysicalMaterial'VH_Cicada.materials.physmat_Cica
    
    da'
    
    	bHasEnemyVehicleSound=true
    	EnemyVehicleSound(0)
    
    =SoundNodeWave'A_Character_IGMale.BotStatus.A_BotStatus_IGMale_EnemyCicad
    
    a'
    }
    I have to get to class now or I would upload a vid, its clear how it should be moving, just the WASD keys are very slow to respond (in both default and edited gravity volume, as suggested)

    Using Space and C I can accelerate forwards and back quite quickly if it is set to 500.

    It was working quite well with the custom model/setup I had for my modification of the Cicada script except it was spinning round endlessly, I could combat this but it would then be going in the opposite direction quite quickly meaning it was very very sensitive. I'm wondering if that was due to scale/bone setup or something.

    Anyways thanks again for the work in here and for any replies

  32. #72

    Default

    FIXED For some reason I need to use greatly exaggerated values :3 That break in the day really helped me get a clear perspective woohoo!

  33. #73
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    The reason why you had to use exaggerated values is simple.

    The mass of any rigid body, including your custom vehicle and the cicada, is based on its volume. The more volume (the bigger your vehicle) is, the more force you need to to move it.

    Just imagine you would try to push a book of a desk. Easy, right?
    Now imagine to push a car out of a garage. Although your are using roughly the same amount of force, the effect is vastly different.

    Every ship/plane needs its own values.
    The values I provided are aimed for a slow moving cicada.

  34. #74

    Default

    Ahh that makes sense, thanks a lot man! Tbf I should have realised that lol xD
    Right now I'm tightening up all the values so its nice and responsive which is going great, this is some excellent code!

    Utilising a chase cam with some snippets from the cicada code I've got it 'chasing' in full 360degree movement and really gives that sense of movement similar to Freelancer/Frontier Elite which is what I was gunning for with this project I'm working on!

    I've unlocked the Roll as well so now I'm tackling with getting my head around the keybinds since Roll has replaced the accelerate and decelerate on Space and C, bit of trial and error though and all should be good ^_^

  35. #75

    Default

    Hokay I'm really struggling getting the mouse code on the previous page to work, so as it stands I'm short 2 keys

    Code:
    // Roll
    // No rolling for now, I will use q and e for the forward movement for the time being
    AR_ForceRotationVectX *= 110 * -AR_NewRise; // AR_NewRise is between -1 and 1
    
    // Pitch
    AR_ForceRotationVectY *= 90 * Throttle; // Throttle is between -1 and 1
    
    // Yaw
    AR_ForceRotationVectZ *= 110 * -Steering; // Steering is between -1 and 1
    
    // Add them together to get final global rotation vector:
    AR_ForceRotation = AR_ForceRotationVectX + AR_ForceRotationVectY + AR_ForceRotationVectZ;
    
    // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 505 * AR_NewRise * AR_ForwardsNormal;
    Code:
    // Roll
    // No rolling for now, I will use q and e for the forward movement for the time being
    AR_ForceRotationVectX *= 110 * -Steering; // AR_NewRise is between -1 and 1
    
    // Pitch
    AR_ForceRotationVectY *= PlayerController(Controller).PlayerInput.aMouseY; // Throttle is between -1 and 1
    
    // Yaw
    AR_ForceRotationVectZ *= PlayerController(Controller).PlayerInput.aMouseX; // Steering is between -1 and 1
    
    // Add them together to get final global rotation vector:
    AR_ForceRotation = AR_ForceRotationVectX + AR_ForceRotationVectY + AR_ForceRotationVectZ;
    
    // The magic happens here
    AR_ForceApplication = AR_ForwardsNormal * Throttle * 505;
    Using the mouse code from the previous page I have the same problem as KongWeeZy where it just does not respond at all to mouse movement. I've tried to add them as binds in DefaultInput.ini but also to no avail, really struggling here, tried to find where Throttle, Steering and Rise are defined as well so I could perhaps add an extra one for Z and X or something just so I can get it all working together.

    EDIT: The mouse X and Y binds are in UDKInput.ini but missing from defaultinput.ini, not too sure where to add them in defaultinput.ini to activate? them.

    All in all, whatever combination I use (minus the 2 buttons) works great except without the missing 2 buttons I am either spinning/rotating/or left dead in the air (with full movement).

    Thanks for taking the time to read this!
    Last edited by Roonast; 12-10-2011 at 07:01 AM.

  36. #76
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    For the mouse: I haven't changed my inis for the mouse at all.

    The bindings doing the magic are in UDKInput.ini, section [Engine.PlayerInput]:
    Bindings=(Name="MouseX",Command="Count bXAxis | Axis aMouseX")
    Bindings=(Name="MouseY",Command="Count bYAxis | Axis aMouseY")

    I should be honest about this, I have never accessed the mouse in singleplayer only coding, went straight for multiplayer. That's why I am not sure if it works the way you try it to do. Logging is the way to go to figure this out.

    For the additional buttons:
    Are you aiming for single or multiplayer?

    If you are fine with a singleplayer game it is less work to do, but getting the multiplayer working later on is a very big load of work.

    Why am I asking whether multiplayer or singleplayer?

    Multiplayer coding makes things at least 4 times more difficult, especially for a beginner, since you have to take care to syncronize values and reduce bandwith usage.

    So what will it be? MP or SP? Beware that I won't help you with multiplayer issuse unrelated with the input for ship, because this a complex topic on its on. Although I might provide links to some tutorials. ;-)
    Last edited by Hiredicespecter; 02-04-2012 at 02:12 AM.

  37. #77

    Default

    Hey man, sorry for the long reply, just got back from work My project is solely a single-player game, the multiplayer aspects would definately be a bit too much for me at the moment, it is something ala-Frontier Elite/Freelancer for my final project at uni, my main project goals at the bare minimum (to stay realistic in my short time frame through my final year) are reasonably tight flying/pewpew mechanics and hopefully some docking/trading/repair between a couple of stations.

    If things go much better than expected then within that, during my games level(s), for progression I want to have some scripted events that have the player having to do a trade run or two, fight enemies(fighters/bomber class), destroy a capital ship by taking out its engines (or something to that effect) to make it exciting for my final showcase. Once uni is out the way in June/July I'll probably then be looking to expand greatly upon the game with good narrative and story to really hammer out the exploration aspect of my game.

    Thanks for the reply btw, your space shooter WIP looks incredible! I'm also pretty gutted tbh as you seem to be achieving what I've been dreaming of making for so long haha, your work is really goddamn good.

  38. #78
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    Thanks. If you have any feedback, comment or suggestion feel free to let me know. Not here, but in my Work in Progress Thread linked to in my signature, since this not the place to discuss my game. ;-)

    Please PM me when you have something to show on your project's progress. I am always curious what developer's of space games do.

  39. #79
    MSgt. Shooter Person
    Join Date
    Aug 2011
    Posts
    209

    Default

    Since I want to code a plane like vehicle within the next few weeks, I had a look at how gravity for flying vehicles works in UDK for starters.

    First of all, why is the space ship, whose code I posted previously, not affected by gravity?

    Because it is using PHYS_FLYING while being driven. Objects in the physic state PHYS_FLYING are no affected by gravity.
    If you exit the space ship, its physic state changes to PHYS_FALLING, in which the ship is affected by gravity and CustomGravityScaling.

    For a plane to be affected by gravity, you could try to use PHYS_FALLING all the time, but this would involve some heavy modification of the vehicle code or might be even impossible without access to native code.
    And since PHYS_FLYING is intended for flying vehicles it is better to stick with it and just add add gravity manually while the space ship/plane is being driven.

    To get the gravity of the gravityVolume the vehicle is currently into (or the world's gravity if it isn't within one):

    Code:
     
    if(bDriving)
    {
        AR_ForceApplication.Z += self.PhysicsVolume.GetGravityZ() * CustomGravityScaling;
    }
    By the way, this behavior makes sense for a game like UT where you wouldn't want something like a plane which needs gravity, lift, drag and thrust. UT just wants some choppers and hovering vehicles.
    This would cover gravity, thrust (the force of the engine) is already covered. I have found the related formulars at wikipedia, but I haven't had the time to test them in UDK yet.

    This side provides an easy explanation of the forces affecting a plane: http://www.aviastar.org/theory/basic...ght/index.html

    Edit

    The calculation of gravity that I provided above is wrong for at least two reasons. First, it doesn't consider the vehicle's mass. Just remember what we all hopefully learned in school: F = m * g
    g = self.PhysicsVolume.GetGravityZ()
    m = self.Mesh.BodyInstance.GetBodyMass()

    Second, there is no need to multiply with CustomGravityScaling, it is already included in GetGravityZ().

    I have included the 0.01, because the resulting gravity was too strong and I assume some constant factor is used natively as well. Maybe you have to experiment with that factor.

    Code:
    if(bDriving)
    {
        AR_ForceApplication.Z += self.PhysicsVolume.GetGravityZ() * self.Mesh.BodyInstance.GetBodyMass() * 0.01;
    }
    I ll post this in an extra post so that the subscribers to this will get a notice of this too.
    Last edited by Hiredicespecter; 05-28-2012 at 05:18 AM. Reason: Found bug

  40. #80

    Default

    Thank you all for a great thread, I've learned a ton reading and experimenting based on the various responses over the past couple months. I quickly got something up and running at first, for a non scriptor, I hope that says something. The above code that Hiredicespecter included for more realistic movement really helped me out a lot. I did have one question though. I'm using an Xbox controller for all of my movement and the controls finally feel right, except that I'd like to bind acceleration to say the left trigger so I can slow down and speed up while leaving Pitch and Roll as they are. How would I go about doing this?

    As a side note, I've been experimenting with UTSkel_Controls for the flaps and rudders and pretty close to getting something that looks halfway decent, though I need to research more on linking these constraints directly to the controller values to respond faster when turning.

    Thanks in advance, great community.


 
Page 2 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.