I need to attach a directional actor to another directional actor. SpriteActor (used for animations) needs to be attached to my custom playerpawn (RPG_LionPlatformer), facing the same direction and being in the same location as the playerpawn. How can I do this?
If this is solved, I may have a new progress video coming out to show off sprites working properly. I have a parser for sprites mostly working, animation and animation managers work properly, and I now need an actor (SpriteActor) that can be used in order to "play" animations on that isn't a playerpawn to avoid dealing with figuring out why animation code either isn't being called or works improperly in player state code. I also have a sprite sheet that acts as a library for textures stored to be played sequentially.
For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
[solved] Attach Actor to Actor
-
LannFyre
- OldUnreal Member
- Posts: 157
- Joined: Fri Mar 13, 2015 7:01 am
[solved] Attach Actor to Actor
Last edited by LannFyre on Thu Jun 29, 2017 1:40 am, edited 1 time in total.
i tryin'a be a gud boi
-
Bleeder91[NL]
- OldUnreal Member
- Posts: 1062
- Joined: Sun Oct 04, 2009 7:22 pm
Re: Attach Actor to Actor
- Set the actor's Physics to PHYS_Trailer;
- Set the actor's owner to your Playerpawn;
- Set bTrailerSameRotation of the actor to True.
- Set the actor's owner to your Playerpawn;
- Set bTrailerSameRotation of the actor to True.
Last edited by Bleeder91[NL] on Fri Jun 02, 2017 4:35 pm, edited 1 time in total.
-
.:..:
- OldUnreal Member
- Posts: 1637
- Joined: Tue Aug 16, 2005 4:35 am
Re: Attach Actor to Actor
It depends, relative to what?
If same rotation and location as playerpawn, you can use PHYS_Trailer.
If same rotation but a location with an offset from playerpawn, then a script like this:
If a relative location and rotation:
If same rotation and location as playerpawn, you can use PHYS_Trailer.
If same rotation but a location with an offset from playerpawn, then a script like this:
Code: Select all
function Tick( float Delta )
{
SetLocation(Owner.Location + vect(0,0,10) + (vect(10,10,0) >> Owner.Rotation));
}Code: Select all
function Tick( float Delta )
{
local Coords C;
C = GetUnitCoords();
C *= rot(16000,0,0);
C *= Owner.Rotation;
SetRotation(OrthoRotation(C.XAxis,C.YAxis,C.ZAxis));
SetLocation(Owner.Location + vect(0,0,10) + (vect(10,10,0) >> Owner.Rotation));
}(ಠ_ಠ)1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD
-
LannFyre
- OldUnreal Member
- Posts: 157
- Joined: Fri Mar 13, 2015 7:01 am
Re: Attach Actor to Actor
How do I set an actor's owner? I've done the other two steps so far. Also here is a test video before I got your replies, I went with a setlocation() setrotation() setup through tick and found some... interesting things about sprites.
https://www.youtube.com/watch?v=__NECIJ ... e=youtu.be
An interesting side note is that sprites only have one polygon (from my understanding and reading) which is the only point affected by light sources, so your sprite could be sitting almost half in dark and half in light, and would only change to a darkened or brightened sprite based on where that poly is.
https://www.youtube.com/watch?v=__NECIJ ... e=youtu.be
An interesting side note is that sprites only have one polygon (from my understanding and reading) which is the only point affected by light sources, so your sprite could be sitting almost half in dark and half in light, and would only change to a darkened or brightened sprite based on where that poly is.
i tryin'a be a gud boi
-
.:..:
- OldUnreal Member
- Posts: 1637
- Joined: Tue Aug 16, 2005 4:35 am
Re: Attach Actor to Actor
You can use Actor.SetOwner() or even better, use spawn owner parameter:
Spawn(class'MyActor',)
i.e from playerpawn: Spawn(class'MyActor',self);
Spawn(class'MyActor',)
i.e from playerpawn: Spawn(class'MyActor',self);
(ಠ_ಠ)1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD
-
LannFyre
- OldUnreal Member
- Posts: 157
- Joined: Fri Mar 13, 2015 7:01 am
[solved] Attach Actor to Actor
Here is what I went with:
Code: Select all
event PostBeginPlay()
{
local bool bSActorFound;
bSActorFound=false;
if ( myActor == none ) {
ForEach AllActors (class'xActor', myActor) {
if (myActor.Owner == none && myActor.AttachActor == none ) {
myActor.SetOwner(self);
myActor.AttachActor = self;
bSActorFound = true;
break;
}
}
if (bSActorFound == false) {
myActor= Spawn(class'myActor',self); // owner = self
myActor.AttachActor = self;
}
}
super.PostBeginPlay();
}Code: Select all
state Active
{
event Tick( float DeltaTime )
{
SetRotation( AttachActor.Rotation );
[...]
}
}i tryin'a be a gud boi