News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 9th Nov 2004, 02:51 AM   #1
zupafly
Registered User
 
Join Date: Aug. 13th, 2004
Posts: 147
Question karma ball movement

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.
zupafly is offline   Reply With Quote
Old 9th Nov 2004, 10:17 AM   #2
ZarQa
Freelance coder
 
Join Date: Jul. 11th, 2003
Location: Holland
Posts: 40
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;
ZarQa is offline   Reply With Quote
Old 9th Nov 2004, 01:23 PM   #3
zupafly
Registered User
 
Join Date: Aug. 13th, 2004
Posts: 147
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
zupafly is offline   Reply With Quote
Old 9th Nov 2004, 08:57 PM   #4
porkmanii
Registered User
 
Join Date: Sep. 9th, 2004
Location: Australia, Qld
Posts: 129
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)..
porkmanii is offline   Reply With Quote
Old 10th Nov 2004, 12:57 AM   #5
zupafly
Registered User
 
Join Date: Aug. 13th, 2004
Posts: 147
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 is offline   Reply With Quote
Old 10th Nov 2004, 03:35 AM   #6
[SAS]Solid Snake
Registered User
 
[SAS]Solid Snake's Avatar
 
Join Date: Jun. 7th, 2002
Location: New Zealand
Posts: 2,633
Use KApplyForces to adjust the Torque and Force. You'll have to learn how to calculate the Torque from a position force however.
__________________
I make the impossible possible ... ... ... to some extent.

Digital Confectioners
[SAS]Solid Snake is offline   Reply With Quote
Old 12th Nov 2004, 01:52 AM   #7
zupafly
Registered User
 
Join Date: Aug. 13th, 2004
Posts: 147
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 is offline   Reply With Quote
Old 12th Nov 2004, 02:02 AM   #8
porkmanii
Registered User
 
Join Date: Sep. 9th, 2004
Location: Australia, Qld
Posts: 129
The Pawn's Rotation would tell you what direction it is facing..
porkmanii is offline   Reply With Quote
Old 12th Nov 2004, 04:18 AM   #9
[SAS]Solid Snake
Registered User
 
[SAS]Solid Snake's Avatar
 
Join Date: Jun. 7th, 2002
Location: New Zealand
Posts: 2,633
Code:
vector offset >> adjustment rotation
For more info, look in ProjectileFire.uc
__________________
I make the impossible possible ... ... ... to some extent.

Digital Confectioners
[SAS]Solid Snake is offline   Reply With Quote
Old 12th Nov 2004, 09:06 AM   #10
zupafly
Registered User
 
Join Date: Aug. 13th, 2004
Posts: 147
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 is offline   Reply With Quote
Old 2nd Feb 2005, 08:07 AM   #11
zupafly
Registered User
 
Join Date: Aug. 13th, 2004
Posts: 147
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 ?
zupafly is offline   Reply With Quote
Old 5th Feb 2005, 01:52 AM   #12
porkmanii
Registered User
 
Join Date: Sep. 9th, 2004
Location: Australia, Qld
Posts: 129
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 by porkmanii; 5th Feb 2005 at 01:55 AM.
porkmanii is offline   Reply With Quote
Old 8th Feb 2005, 03:10 AM   #13
zupafly
Registered User
 
Join Date: Aug. 13th, 2004
Posts: 147
thx for explaning works now
zupafly is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:23 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer