Jump to content

[KSP 1.3.1] Who Am I - Identify your kerbals in IVA (1.0.4) - 2017-10-11


RealGecko

Recommended Posts

hmm the mesh part is simple, but material part, maybe you would need custom shader or maybe you can go with the standard shaders for it, question is, what would be the mesh? if it is text, then that may complicate things a little, but long story short, any mesh would need renderer, a vertex array plus another array that would tell the system what index in that array should be the order, there are many tutorials online both in text and video formats that maybe more usefull than what ever i can come up with when it comes to procedural meshes and for  shader, ufff i am ever worse than you knowledge wise in that regard

Link to comment
Share on other sites

Actual insomnia attack ended after 15 minutes of coding:

MDv4hyy.png

As you can see I have a square that's bound to kerbinaut's backpack, but first of all it is affected by illumination, so you won't see anything in the dark void of deep space, and second is that Unity rendering to texture is really really tricky.

And I have more interesting things to do, like playing my career transitionned from 1.1.3 to 1.2.1 :sticktongue:

Link to comment
Share on other sites

42 minutes ago, RealGecko said:

Actual insomnia attack ended after 15 minutes of coding:

MDv4hyy.png

As you can see I have a square that's bound to kerbinaut's backpack, but first of all it is affected by illumination, so you won't see anything in the dark void of deep space, and second is that Unity rendering to texture is really really tricky.

And I have more interesting things to do, like playing my career transitionned from 1.1.3 to 1.2.1 :sticktongue:

umm did you ever thought about using new gui system with a world type canvas?

Edited by Jiraiyah
Link to comment
Share on other sites

 

9 minutes ago, RealGecko said:

Link to API?

db07d65d118746f6926295532d5f9280.png

there is no api, they are game objects with some components and children, in this image i have a canvas with a text child, that text child has a text component on it, they behave like any game object in the scene but still will render like any other gui !

if you can instantiate any game object prefab in ksp (im'n not sure of this but it should be possible) you make the canvas with the children elements (GUI stuff) then make a prefab and export it (not sure how to get a prefab out to be used in ksp) and in code you instantiate the prefab, then parent it to the kerbal, and you can eaily move and rotate and change the text as you desire, that is if you want a flat looking stuff, as i said, i am not sure if you can export prefabs and use them in ksp or not, but if possible that is a faster way to approach this.

alternatively, you should be able to create the canvas by code, just make a canvas in unity and take a look at it's components and how they are set up, mimic that in code, then make another empty game object and do the same process for text ui element, this should work 100% even in ksp, after having the canvas and text set, you can follow the previous steps of parenting and positioning it :D

Edited by Jiraiyah
Link to comment
Share on other sites

oO dude it's 100% simpler than the process of making procedural stuff !!!!

take a look at that picture for example, to make a canvas by code here is somewhat pseudo code :

var go = new GameObject();

var rectTransform = go.AddComponent<RectTransform>();

var raycaster = go.AddComponent<GraphicRaycaster>();

var canvas = go.AddComponent<Canvas>();

var scaler = go.AddComponent<CanvasScaler>();

canvas.RenderMode = whatever.WorldSpace

...

blah blah

then

go.transform.parent = theKerbal.transform

go.Position = ....

is that too complicated?

Edited by Jiraiyah
Link to comment
Share on other sites

Well, I think this is much simpler:

HUD = new GameObject("HUD" + kerbal.name.Replace(" ", ""));
HUD.AddComponent<MeshRenderer>();
HUD.AddComponent<MeshFilter> ();
HUD.GetComponent<MeshFilter> ().mesh = Meshes.Plane ();

KerbalEVA part = kerbal.GetComponent<KerbalEVA> ();
HUD.transform.parent = kerbal.transform;

HUD.transform.localScale = new Vector3 (0.2f, 0.2f, 0.2f);
HUD.transform.localRotation = new Quaternion(0.0f, 0.0f, 0.0f, 0.0f);
HUD.transform.localPosition = new Vector3 (0.0f, 0.0f, -0.32f);

MeshRenderer rend = HUD.GetComponent<MeshRenderer> ();

rend.material.EnableKeyword ("_EMISSION");
rend.material.SetColor ("_EmissionColor", Color.blue);
rend.material.SetFloat ("_EmissionScaleUI", 3);
rend.material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;

Problem is only in last 5 lines, they do not work, I miss something.

Link to comment
Share on other sites

4 minutes ago, RealGecko said:

Well, I think this is much simpler:


HUD = new GameObject("HUD" + kerbal.name.Replace(" ", ""));
HUD.AddComponent<MeshRenderer>();
HUD.AddComponent<MeshFilter> ();
HUD.GetComponent<MeshFilter> ().mesh = Meshes.Plane ();

KerbalEVA part = kerbal.GetComponent<KerbalEVA> ();
HUD.transform.parent = kerbal.transform;

HUD.transform.localScale = new Vector3 (0.2f, 0.2f, 0.2f);
HUD.transform.localRotation = new Quaternion(0.0f, 0.0f, 0.0f, 0.0f);
HUD.transform.localPosition = new Vector3 (0.0f, 0.0f, -0.32f);

MeshRenderer rend = HUD.GetComponent<MeshRenderer> ();

rend.material.EnableKeyword ("_EMISSION");
rend.material.SetColor ("_EmissionColor", Color.blue);
rend.material.SetFloat ("_EmissionScaleUI", 3);
rend.material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;

Problem is only in last 5 lines, they do not work, I miss something.

wait wait, don't emissive property need a texture?

edit : o~k i think you are using the standard shader and not the shader from part tools? would that work? because in part tools i see emissive/bumped specular for example and it does not have a property callsed emission, if you want to change the shader of the material you need to do it via code first

Edited by Jiraiyah
Link to comment
Share on other sites

1 minute ago, RealGecko said:

Look at the OP post date here:

Two days earlier I started learning C#, Unity API and KSP API :D:D:D

 

lmao, ok ok, i suggest to watch 3dbuzz.com first, they have tons of good tutorials for c# and Unity, also, burgzergarcade on you tube is not bad for unity and c# for starters follow his older videos of hack and slash and watch 3d buzz videos and before you know, you are pro :wink: it won't take more than few weeks to get you up and running in both of them, just remember, the MMO stuff on 3dbuzz is way more advanced than what you may need for now :D

Link to comment
Share on other sites

  • 6 months later...

Version 1.0.3 is out:

  • Added kerbonaut level info
  • Messages are shown via ScreenMessages
  • Modifier Key + B brings up transfer dialog

As ScreenMessages are now displayed with readable font I decided to remove this ugly looking panel and now show info with standart messages in the top center of the screen.

Pressing Alt + B (Cmd + B for Mac) will bring up transfer dialog under cursor position. The idea was to make kerbal go EVA, but no API method seems to allow this and no EVA button in transfer dialog while in IVA, this API is a mess :/

Link to comment
Share on other sites

Crap! I always forget about AVC version files :D

I've updated version file on GitHub, so if you're connected to the Internet AVC won't bother you. If you're offline AVC will say that mod is for KSP 1.2.0, but that can be ignored :)

Link to comment
Share on other sites

  • 6 months later...
  • 2 months later...
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...