Jump to content

[20.2] EVA Followers 0.12 (Open to a Good Home)


Fel

Recommended Posts

Again, all thanks to Razchek for the solution to ragdolls.

I have an idea how to handle formations, even giving the player control over creating them. (Perhaps a little annoying for complex ones, but yeah)

The idea is 'marbles in a box', as it stands the kerbals act a large bit like marbles; when they break 'formation' it is usually because they aren't really bounded on the sides.

Hence allowing the player to "draw" a series of vectors around the kerbals (vector-casts, what quantum fuel line uses), and then using this box to limit where the kerbals can go.

This would follow in a straight line very well, turns wouldn't look as "neat," (I can keep it pointing at the lead kerbal, but marbles in a box, the stronger the turn the more they're going to move around.)

Link to comment
Share on other sites

Cool... But... there is any progress with fixing the Side walking?

I... thought....

REALLY?

I went to the pole and saw it happening... and I thought I corrected it (which was half my fault as well).

*My note on the issues is just about code I had to remove.

Problem is that if you jetpack above a following kerbal he'll rotate to face you, except you're above him.

Edited by Fel
Link to comment
Share on other sites

I... thought....

REALLY?

I went to the pole and saw it happening... and I thought I corrected it (which was half my fault as well).

*My note on the issues is just about code I had to remove.

Problem is that if you jetpack above a following kerbal he'll rotate to face you, except you're above him.

i don't know if you already know this uhm... i don't want to get you mad or something... but... I noticed that shis happens... Everywhere everytime in... every planet... huh...

Link to comment
Share on other sites

I may be a little exasperated, that should have been fixed.

I did a run around the mun just now, 5 different landings from southish to north (From ~50S to 70N)... I cannot reproduce the behaviour anymore.

I know they'll freakout a bit now if the leader kerbal is higher than them (the code I was using to try and stop that was part of the problem, however).

Can I get a confirmation from another person? (I want to know if this is a unique problem hence possibly some kind of plugin interference)

*I mean, I really wanted to start work on formations, and figured that the "higher than me" issue could be resolved over time. Hence the major version change, I thought it was stable :S

Edited by Fel
Link to comment
Share on other sites

Okay this has awesome potential. Quoting a recent discussion with a friend:

"I've played other space sims."

"Yeah, but they don't have Kerbals."

Useless and charming. This and Chatterer are must have mods!

Link to comment
Share on other sites

ok i will try the new version...

Edit: I tryed it, The Side walking its fixed.

I was testing it... It works really good. But, i don't know why, but the mod stoped working in the mun. The kerbals Didn't follow me.

(They don't love me ;.;)

This was at: 11º 8' 7'' Lat. 91º 55' 22'' Long.

BUT THEN, for no reason, it worked again 2 or 3 minutes later.

Keep with the great work, i really love this mod.

Edited by Pachi3080
Link to comment
Share on other sites

For those who like barely functional alpha software, have fun XD

https://www.dropbox.com/s/bpah4v1hun27ul7/EVA%20Followers.zip

Why am I releasing something whose proof of concept is basically "adequate" and WIP is insanely broken; idk... I thought I'd have gotten it done tonight and now am a little hyper.

(Concept cannot draw but operates fairly correctly, WIP can draw (MMB to 'quit') but has unleased a whole new monster).

Link to comment
Share on other sites

This is awesome, Im going to play with the source a little.

Edit:

I've played a little with it, and I loved it, but I would like to see some changes so I made some tweaks though to the old code. (didn't find out your new WIP)

You can see the difference here:

http://youtu.be/dyu8BA9N4FM

I do not get what the "isUnion" boolean is for, I can see it has something to do with the formations, but consider to get rid of it, because it makes for multiple code doing the same. I left it in thought for these changes.

In the code you rotate the kerbal before v.delta because of the rapid jerky movement it will make;


else {
//Eventually want to get rotations right, v.delta is somewhat important, but it causes rapid head moving when very close.
if (inUnion) v.part.vessel.SetRotation(Quaternion.LookRotation( move, me.fUp));

move += v.delta;
move *= speed;

if (!inUnion) v.part.vessel.SetRotation(Quaternion.LookRotation( move, me.fUp));
me.rigidbody.MovePosition(me.rigidbody.position + move);
}

I've replaced that with different code, so you get:


} else {

move += v.delta;
move *= speed;

Quaternion from = v.part.vessel.transform.rotation;
Quaternion to = Quaternion.LookRotation(move, me.fUp);
Quaternion result = Quaternion.RotateTowards(from, to, me.rotPower * ROTATION_MULTIPLIER);

//kinda work.
v.part.vessel.SetRotation(result);
me.rigidbody.MovePosition(me.rigidbody.position + move);
}

Not perfect and not optimized, but get rid of the jerky movement (for the most part) and get rid of the kerbal's trying to face you when there is a height different.

Also, as you can see I removed the direct facing the leader; I didn't like that so there is the ROTATION_MULTIPLIER for, also I've made constants...


public class EVA_CMDS_b : MonoBehaviour
...

public const float RUN_DISTANCE = 5; //before 25
public const float SETTLE_DISTANCE = 3; //before 4
public const float ROTATION_MULTIPLIER = 3;

.. so I could tweak it a little faster, instant of looking where the piece of code is.

I've changed how the animations starts, in the code you use (for all changes to the animations)


me.animation.Play("wkC_run", PlayMode.StopAll);

What seems to produce jerky movement, not that much but small, I've changed that to: (for all changes to the animations)


me.animation.CrossFade("wkC_run");

I do NOT know if this is a "good" way of doing it, because I have not played with Unity that long, but seem to get rid of the jerky movement from running to walking or walking to idle.

Perhaps I should try to walk on the pools... I didn't try that, so don't know anything yet about it.

Edited by MSD
Do not like a double post!
Link to comment
Share on other sites

This is awesome, Im going to play with the source a little.

Edit:

I've played a little with it, and I loved it, but I would like to see some changes so I made some tweaks though to the old code. (didn't find out your new WIP)

You can see the difference here:

http://youtu.be/dyu8BA9N4FM

I do not get what the "isUnion" boolean is for, I can see it has something to do with the formations, but consider to get rid of it, because it makes for multiple code doing the same. I left it in thought for these changes.

In the code you rotate the kerbal before v.delta because of the rapid jerky movement it will make;


else {
//Eventually want to get rotations right, v.delta is somewhat important, but it causes rapid head moving when very close.
if (inUnion) v.part.vessel.SetRotation(Quaternion.LookRotation( move, me.fUp));

move += v.delta;
move *= speed;

if (!inUnion) v.part.vessel.SetRotation(Quaternion.LookRotation( move, me.fUp));
me.rigidbody.MovePosition(me.rigidbody.position + move);
}

I've replaced that with different code, so you get:


} else {

move += v.delta;
move *= speed;

Quaternion from = v.part.vessel.transform.rotation;
Quaternion to = Quaternion.LookRotation(move, me.fUp);
Quaternion result = Quaternion.RotateTowards(from, to, me.rotPower * ROTATION_MULTIPLIER);

//kinda work.
v.part.vessel.SetRotation(result);
me.rigidbody.MovePosition(me.rigidbody.position + move);
}

Not perfect and not optimized, but get rid of the jerky movement (for the most part) and get rid of the kerbal's trying to face you when there is a height different.

Also, as you can see I removed the direct facing the leader; I didn't like that so there is the ROTATION_MULTIPLIER for, also I've made constants...


public class EVA_CMDS_b : MonoBehaviour
...

public const float RUN_DISTANCE = 5; //before 25
public const float SETTLE_DISTANCE = 3; //before 4
public const float ROTATION_MULTIPLIER = 3;

.. so I could tweak it a little faster, instant of looking where the piece of code is.

I've changed how the animations starts, in the code you use (for all changes to the animations)


me.animation.Play("wkC_run", PlayMode.StopAll);

What seems to produce jerky movement, not that much but small, I've changed that to: (for all changes to the animations)


me.animation.CrossFade("wkC_run");

I do NOT know if this is a "good" way of doing it, because I have not played with Unity that long, but seem to get rid of the jerky movement from running to walking or walking to idle.

Perhaps I should try to walk on the pools... I didn't try that, so don't know anything yet about it.

Use "me.turnRate" rather than "rotPower" (RotPower is for reaction wheels)

Right now, I realize that "me.fUp" is actually the wrong thingy; you probably want me.referenceTransform.Up (or was it forward; the transform is weird.)

[me.fUp actually follows the camera, (err, I think it does... again, should recheck; I know fFwd and fRgt do)]

inUnion will cause the Kerbals to "tighten their movements." Which isn't the same as the "lazy following" that normally happens (or perhaps adding in some slight (not noise, but "go in a slight offset away or get distracted by something")).

I have zero idea of how animations work, and Quaternions are "what the heck" (I mean, I believe they're just rotations (w) about an axis (vector); but the math is something I've never seen). From cursory glance, I'd say that you're using a "low pass filter" with the "Quaternion.RotateTowards", which would certainly smooth things out.

Also, I don't trust C# to obey any preprocessor directives. I'll check it (via reflection) later; but given what I have seen, I suspect "const" will just create a property rather than inline like it should. [And yes, I guess that it could obey it AND create the property, but my ASM isn't good enough to check that.]

I'll do a source cleanup and start work again tomorrow; but I do appreciate the help (I normally don't do this type of work so I'm coming up with the algorithms as I go along.)

** Also, just to confirm; the distances are distances squared. "25" means "5m", (Just saying due to you saying "5" rather than "4" or akin). Unity Documentation advises that the Sqrt is more expensive than dotting the vector with itself; so I said "sure, I can write the code using squares."

*** Notes while watching video

Problem with allowing leader chaining is that it almost necessitates a GUI. "Who is connected to whom" gets very complicated.

"Face the leader" is just a very easy "I don't want to write a GUI" bit of code. I typically do tests with 10 kerbals which makes it exceptionally helpful to actually SEE who is following. (Personally, I'd like to replace it with a "wave" or something, visual confirmation is always a nice thing)

Animations for mun walk do need to be sped up, I can probably do that.

*I'm not certain how well waypoints will work out. The universe is centered about the "active vessel" (note: I believe this is "active vessel that instantiated the physics for an area, but have not completely tested as such"), which means that any "load" will cause the position vectors to change (In theory you could update to the leader; but then you have to know the original position relative to the new position).

*That sliding is... I believe... ragdolls. [3:32], the "Get up" animation is overridden at times...

Edited by Fel
Link to comment
Share on other sites

They won't walk ANYWHERE except Kerbin. Minmus, Mun, Gilly, Eve, Tylo, Laythe, I even tried the Sun! (The reason they wouldn't work there is likely quite different than the other places) THEY JUST WALK IN PLACE!

Edited by GregroxMun
Link to comment
Share on other sites

Here's an idea for you: Maybe, since you're remotely operating the Kerbals to follow a player around, you could design a wandering algorithm that allows Kerbals to move about the base randomly, but not too far from any structures to keep them from getting lost?

Link to comment
Share on other sites

I got a little "too" preoccupied this 4th of July weekend XD; so no real advancements in the formation code :(

They won't walk ANYWHERE except Kerbin. Minmus, Mun, Gilly, Eve, Tylo, Laythe, I even tried the Sun! (The reason they wouldn't work there is likely quite different than the other places) THEY JUST WALK IN PLACE!

Save, then re-load.

I only managed to reproduce it once on Duna, and when I went back to "find the bug" it resolved itself. (Actually, technically the bug is that the kerbal "!v.part.GroundContact", that is the only way it could walk in place; which is a terrain issue.)

[Note: Works the same being saved on EVA or spawned from lander]

Here's an idea for you: Maybe, since you're remotely operating the Kerbals to follow a player around, you could design a wandering algorithm that allows Kerbals to move about the base randomly, but not too far from any structures to keep them from getting lost?

There is a "poor man's" algorithm in place for that. It needs improvement, needless to say.

Link to comment
Share on other sites

I have zero idea of how animations work, and Quaternions are "what the heck" (I mean, I believe they're just rotations (w) about an axis (vector); but the math is something I've never seen). From cursory glance, I'd say that you're using a "low pass filter" with the "Quaternion.RotateTowards", which would certainly smooth things out.

Rotation needs to worked out a little, I smooth it a little but you can still see it twitchy, also the animations as a whole is not sweet yet.

"Face the leader" is just a very easy "I don't want to write a GUI" bit of code. I typically do tests with 10 kerbals which makes it exceptionally helpful to actually SEE who is following. (Personally, I'd like to replace it with a "wave" or something, visual confirmation is always a nice thing)

Agreed, hopefully in the next update you don't have to (different outfits.. but don't wait for it =) )

*I'm not certain how well waypoints will work out. The universe is centered about the "active vessel" (note: I believe this is "active vessel that instantiated the physics for an area, but have not completely tested as such"), which means that any "load" will cause the position vectors to change (In theory you could update to the leader; but then you have to know the original position relative to the new position).

By keeping track of a list of vectors, I've implemented waypoints (for each EVA). It works the same way as the leader, except they ignore the leader. I've also tested walking on most moons.. and it is strange I cannot walk on Gilly but they can :)

http://www.youtube.com/watch?v=_LNJbhyJY4Y

I've still trouble with the GUI system, it seem I need to use Events["Patrol"].guiActive; or it will not show up at all...

Link to comment
Share on other sites

  • 3 weeks later...

By keeping track of a list of vectors, I've implemented waypoints (for each EVA). It works the same way as the leader, except they ignore the leader. I've also tested walking on most moons.. and it is strange I cannot walk on Gilly but they can :)

http://www.youtube.com/watch?v=_LNJbhyJY4Y

I've still trouble with the GUI system, it seem I need to use Events["Patrol"].guiActive; or it will not show up at all...

OMFG I NEED THIS!!!!!

please tell me your updating or branching for .21?????

Link to comment
Share on other sites

Doesn't seem to be working for me, I've tried putting the MSD folder, then tried putting the plugin into plugins. Neither of them gave me the menu buttons I see in the video.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...