karma ball movement

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

zupafly

New Member
Aug 13, 2004
147
0
0
Hi,

I created a karma ball which rolls down hills etc. Its spawned by using a pickup. So the player picks up the powerup, fires and then the ball spawns behind the player, I would want it to spawn with speed, meaning I want it to roll back once spawned with a certain speed. Anyone knows how ?

I tried using KStartLinVel =-200,0,0 in my KarmaParams, but it only works well if my ball doesnt rotate and when bKAllowRotate=False its kinda ugly cause then the ball doesnt seem to roll but just move.
 

ZarQa

Freelance coder
Jul 11, 2003
40
0
0
Holland
I'm not sure if this works, but you can give the object a velocity. You would do that like so:

Code:
local float Speed;
local vector Direction;
local KActor Ball;

Ball = Spawn(class'yourpackage.yourball');
//Speed and direction need to be changed to a value that fits your purpose.
Ball.Velocity = Speed * Direction;
 

zupafly

New Member
Aug 13, 2004
147
0
0
thx for reply, I tried it before and didnt work either, I think problem is the rotating of the ball maybe I should set some karma physics different. I can make ball move perfectly using these command or with KStartLinVel stuff but then it moves instead of "roll" because I have to turn off bKAllowRotate to get it to work, else it doesnt really do much.

Code:
egin Object Class=KarmaParamsRBFull Name=KarmaParams0
         Kmass=3.5000000
         KStartEnabled=True
         bClientOnly=False
         bKAllowRotate=True
         KFriction=0.250000
         KRestitution=0.750000
         KImpactThreshold=1.000000
         KStartLinVel =-200,0,0

         KActorGravScale=1
         KLinearDamping=0
         KAngularDamping=0.000000
         bKDoubleTickRate=True
         KInertiaTensor(0)=0.100000
         Name="KarmaParams0"
     End Object
 

porkmanii

New Member
Sep 9, 2004
129
0
0
Australia, Qld
Have you tried using KAddImpulse? I'm not exactly sure on how to use it, but U4eT's Industrial Anti-gravity Mover uses KAddImpulse to drag ragdolls around (by a specific bone)..
 

zupafly

New Member
Aug 13, 2004
147
0
0
no havent used it but I dont wanna "drag" my karma object, it needs to roll, moving it is no problem but moving it rolling is. I'll give it try though but it just needs to move for little time, maybe I better make it a projectile to "shoot" ball off.
 

zupafly

New Member
Aug 13, 2004
147
0
0
thx for reply, ball is moving nicely now. I still have a question though, I'm trying to make it spawn behind the player so I set x to -50 for the spawn, so normally if player is facing normal way it does spawn behind, but if player rotates or something it spawn like on his side or sometimes infront ? Any way I can see which direction player is facing ?
 

zupafly

New Member
Aug 13, 2004
147
0
0
I used this coding, the locationtarget is behind the location of the instigator. So if I put the rotation of the instigator like this the ball comes out the same rotation angle as the instigator is at that moment ?

It seemed to be so ingame but dunno if it's right, it looks right ingame

Code:
RotatorTarget = Instigator.Rotation;
Spawn(class'RcRacing.RcBal', Instigator,,LocationTarget,RotatorTarget);
 

zupafly

New Member
Aug 13, 2004
147
0
0
When the ball is spawned it rolls out right direction but when facing other direction it still rolls out in same direction. I know it has got to do with the direction in unreal. But how can I see which direction car is facing ? North South ?

Code:
event KApplyForce(out vector Force, out vector Torque)
{
  Force=vect(0,-5,0);
  Torque=vect(0,-5,0);
}
I use this coding to spawn ball but it has to 5 if car is facing other direction but I dont know how to get car direction properly. Rotation has 3 variables if it is right thing to look at which one should be what value then to be in certain direction ?
 

porkmanii

New Member
Sep 9, 2004
129
0
0
Australia, Qld
Read this.

Rotators have 3 parts:
- Pitch (think up/down... like nodding your head "yes")
- Yaw (think left/right... like shaking your head "no")
- Roll (tilt your head to one side, so you're still looking the same direction, but one ear is pointing up and the other down).


Edit:
You'll want to use all three, or at least the first two. i.e.:
Code:
event KApplyForce(out vector Force, out vector Torque)
{
  Force = Vector(Rotation) * 5;
  Torque = Force;
}
 
Last edited: