Announcement

Collapse
No announcement yet.

how can i addforce or addimpulse to a KActor in udk ?

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

    how can i addforce or addimpulse to a KActor in udk ?

    Hello ,

    i'm new to udk , and i'm working on a simple project

    i have a question :-

    how can i addforce to affect a kactor ball ? and how can i change the force amount and direction using kismet ?

    i searched a lot , but i'm new to udk and specially to unreal script ,

    so if anyone can help me to add a kactor ball which i can change the force that affects it manually using kismet



    what i did :-

    i imported a spherical static mesh into udk , and i did set the collision for it

    i placed it in my level as a kactor , and it drops to the ground because of the gravity ,, everything is ok until now

    but the problem is that i couldn't add another force to move the ball , i searched and i found something call (addforce - addimpulse) but i really dont know how can use them .

    if someone can help me , i'll be so grateful


    thanks

    #2
    up :S

    Comment


      #3
      Use UnrealScript, it has functions which you have in your title, AddForce and AddImpulse :P

      Comment


        #4
        yes yes i know that it's there , but the problem is that i dont know how to link it to my KActor and how to link it into kismet .

        anyone can help ?

        Comment


          #5
          From where you want to call it..?

          Comment


            #6
            i want to call it from kismet , for example every 5 secends it changes the direction of that force (to simulate wind or something)

            Comment


              #7
              0. In editor select KActor, open Kismet and from right click menu select New Object Var Using HereYourKActor.
              1. Add:
              ___a. Level Loaded
              ___b. Delay
              ___c. Set Vector Components and three Variabe Random Float
              ___d. Set Velocity and Variable Vector
              2. Link Loaded and Visible to Delay In, set Duration to 5 sec and link Out to In
              3. Link Delay Out to Set Vector Components In, link three variabe Float (one to X, one to Y, one to Z - set Min and Max i.e. -500 to 500) and Output Vector to variable Vector
              4. link Set Vector Components Out to Set Velocity In, link variable Vector to Velocity Dir and KActor Object to Target.
              5. Run PIE..

              This is very basic setup...

              Comment


                #8
                thank you very much

                in my case , this won't help me , because i'm already controlling the ball using joystick (for mobile)

                so when i say : set velocity , it's not gonna work properly because i'm setting velocity every .05 second .



                what i think that will help me is the function :setimpulse . but the problem is that i dont know how to link it to my kactor.

                and thanks again

                Comment


                  #9
                  Try it anyway, but add another Delay between Set Vector Components and Set Velocity and set Duration to that .05 sec - should work.

                  Comment


                    #10
                    i have been trying to set velocity all the week . i got a good result , but i couldn't affect it on the ball for 2 seconds continually for example because it affected the ball movement from joystick .

                    any idea about addimpulse thingy ?




                    i found this post :- http://forums.epicgames.com/threads/...lse-help/page2

                    it's really close to what i want , but i followed him and got some errors :S


                    thanks

                    Comment


                      #11
                      You mean that:
                      Code:
                      Simulated Event Tick(Float DT)
                      {
                        //Do Gravity
                        GravityForce( DT );
                      }
                      
                      Simulated Function GravityForce( Float DeltaTime )
                      {
                        StaticMeshComponent.AddForce(vect(0,0,-110));
                      }
                      ...or the Ball controller..?

                      Comment


                        #12
                        when i followed him , i got an error in this line

                        PlayerBall = RollingBallGame(WorldInfo.Game).Ball;


                        ----

                        thanks very much

                        Comment


                          #13
                          Originally posted by isk View Post
                          PlayerBall = RollingBallGame(WorldInfo.Game).Ball;
                          This mean, that he store the Ball instance in his GameInfo - do the same...
                          Post YourPlayerController and YourBall code.

                          Comment


                            #14
                            i did what he did , so my PlayerController and my Ball are the same as him , except the part which is about static mesh , because his mesh is different than mine.

                            i opened gameinfo.uc , but i didn't know what to do because i'm noob in unreal script

                            Comment


                              #15
                              Originally posted by isk View Post
                              i opened gameinfo.uc , but i didn't know what to do because i'm noob in unreal script
                              Not GameInfo.uc - don't touch that class, you should do this in YourGameInfo.uc... Post all you've got...

                              Comment

                              Working...
                              X