PDA

View Full Version : RB_Constraints - can't get it to work



danimal'
11-10-2009, 09:29 PM
So I'm pulling out my hair, I've learned to do things super simple to figure out what's wrong but I have no idea why this does nothing. Below is a super simple modified weapon, that upon firing should be spawning a RB_Constraint and attaching my character. I literally pulled this wholesale from the Whizzle creation docs (where they constrain the player sphere to 2d), seen here: http://www.udk.com/elements/downloads/Whizzle_Creation_Document_1_2.pdf

- It is firing, I can tell b/c I can push rigid bodies around a level with it b/c I set dmg and dmg type which is being used as an impulse on the rigid body.
- It does get past the spawning function, that's why I set ammocount=10, so I have a visual clue that it does get there.
- Yet there is no constraint or constraining action whatsoever.

Weapon:


class UTWeap_Test extends UTWeapon;

simulated function InstantFire()
{
super.InstantFire();
SetFlashLocation(Location);
CustomSpawnConstraint();

}

simulated function CustomSpawnConstraint()
{
local RB_ConstraintActor TwoDConstraint;

TwoDConstraint = Spawn(class'RB_ConstraintActorSpawnable', , '', Location, rot(0,0,0));
TwoDConstraint.ConstraintSetup.LinearYSetup.bLimit ed = 0;
TwoDConstraint.ConstraintSetup.LinearZSetup.bLimit ed = 0;
TwoDConstraint.ConstraintSetup.bSwingLimited = true;
TwoDConstraint.InitConstraint( UTPlayerController, None );
Ammocount=10;
}


EDIT: I figured out that I'm failing to set the Constraint to my player character. I thought I should use UTPlayerController, but that doesn't seem to work. Any ideas?

Also, anyone know why: show constraints isn't working from the command line? It'll even tell you in-engine that it's on except that... it's clearly not.

danimal

Allar
11-11-2009, 12:09 AM
I'm just learning unrealscript myself... but...

Doesn't the keyword 'self' point to the current actor class you are in, in this case UTWeap_Test?

You may want to try...


TwoDConstraint.InitConstraint( Pawn(Owner), None );

You may not need to cast to Pawn, but in all cases where I've seen Owner I have always seen it typecasted to either Pawn or a custom/derived from Pawn class.

Sorry if I'm completely wrong.

danimal'
11-11-2009, 12:22 AM
I'm just learning unrealscript myself... but...

Doesn't the keyword 'self' point to the current actor class you are in, in this case UTWeap_Test?

Yah I realized that awhile back but it makes no difference. I've tried the pawn variety.

EDIT: So I tried making 2 custom spawnable KActors and it worked just fine. I spawn them and then connect them using the above code. Obviously then I'm failing on attaching it to my player properly. Which does bring up ambiguity with me. Since Constraint works by defining 2 Actors, what is the actual, in-game running around "Actor". I thought it was UTPlayerController (or a derivative), but when I try to constrain to that Actor, it doesn't work. Ideas? Suggestions?

danimal

artimusp
11-21-2009, 11:19 PM
Have you figured this out yet? I too am having the same issue. Do the constraints only work with KActor's? I've been trying to use the UTPawn which is an actor but not a KActor. I would imagine that's the issue since it seems in the whizzle doc they are just using a static mesh so they just used KActor. anyone know of another way to constrain a pawn to only move in a certain directions?

Artimus

TheSpaceMan
11-22-2009, 08:44 AM
Like some one said before. A realy easy way is manualy lock a dimension. It's not recomended if it can be solved trough proper physics. Otherwise it's just the vector for the pawn position. reset one of a axis to the depth you want to limit the pawn too. Set the pawn position to your changed vectors position.

danimal'
11-22-2009, 03:50 PM
The point isn't to constrict to a dimension, the point would be to utilize the constraint system on the Pawn. Imagine attaching Pawn to a nice ball and socket joint, ta-da you've created a physics rope.

No artimus, I couldn't get it to work. I spent a week trying to hack my way around it but never got it to even remotely work. To test what constraints work with, I just tried attaching different types of actors in the editor, it IS picky about what you can attach or not. I tried to trick the system by using things constraints can use (KActors) and then attaching the Pawn to the constrained KActor, but it fails.

Would be sweet if you could do this, if anyone ever figures out different down the road let us know, otherwise I'm reasonably sure you can't do this as-is without some extensive re-coding of the pawn class.

danimal

Jordaan
12-16-2009, 08:12 AM
anyone manage to get this or something similar to work (applying a constraint to the player)?

AAREN24
03-11-2010, 01:04 AM
Nice post, Keep up the good work

Acecutter69
03-11-2010, 01:12 AM
what is it that you want to constrain exactly? still not sure of your goal here. there just might be a different aproach to your problem ;)