Jump to content

Search the Community

Showing results for tags 'box'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements
    • Welcome Aboard
  • Kerbal Space Program 2
    • KSP2 Dev Updates
    • KSP2 Discussion
    • KSP2 Suggestions and Development Discussion
    • Challenges & Mission Ideas
    • The KSP2 Spacecraft Exchange
    • Mission Reports
    • KSP2 Prelaunch Archive
  • Kerbal Space Program 2 Gameplay & Technical Support
    • KSP2 Gameplay Questions and Tutorials
    • KSP2 Technical Support (PC, unmodded installs)
    • KSP2 Technical Support (PC, modded installs)
  • Kerbal Space Program 2 Mods
    • KSP2 Mod Discussions
    • KSP2 Mod Releases
    • KSP2 Mod Development
  • Kerbal Space Program 1
    • KSP1 The Daily Kerbal
    • KSP1 Discussion
    • KSP1 Suggestions & Development Discussion
    • KSP1 Challenges & Mission ideas
    • KSP1 The Spacecraft Exchange
    • KSP1 Mission Reports
    • KSP1 Gameplay and Technical Support
    • KSP1 Mods
    • KSP1 Expansions
  • Community
    • Science & Spaceflight
    • Kerbal Network
    • The Lounge
    • KSP Fan Works
  • International
    • International
  • KerbalEDU
    • KerbalEDU
    • KerbalEDU Website

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Twitter


About me


Location


Interests

Found 3 results

  1. Not sure if this is a bug or not: I was able to put a cardboard box on Val's back, just like a Portable Container, and load it up, and unload the items, but I couldn't find a way to take the box off her back, other than boarding a ship. Then it just falls to the ground outside. I'm able to drag a Portable Container back into the Inventory of a Storage Container, but the same action doesn't work with a Cardboard box. Is that by design?
  2. I'm currently trying to create a box from the raw vertices, and make this object visible in flight (map view, tracking view, normal view). Here is my code so far: using System; using System.Collections.Generic; using UnityEngine; namespace KSPPlugin { [KSPAddon(KSPAddon.Startup.EveryScene, false)] public class KSPPlugin : MonoBehaviour { private float last_time = 0.0f; private float interval = 5.0f; private GameObject testbox_obj = null; private MeshRenderer testbox_renderer = null; private MeshFilter testbox_filter = null; private const int MAP_LAYER = 10; private const int FLIGHT_LAYER = 15; void Awake() { } void Start() { Debug.Log("TEST ADD CUBE"); testbox_obj = new GameObject("testbox"); testbox_filter = testbox_obj.AddComponent<MeshFilter>(); Mesh mesh = testbox_filter.mesh = new Mesh(); testbox_renderer = testbox_obj.AddComponent<MeshRenderer>(); float length = 20f; float width = 20f; float height = 20f; #region Vertices Vector3 p0 = new Vector3(-length * .5f, -width * .5f, height * .5f); Vector3 p1 = new Vector3(length * .5f, -width * .5f, height * .5f); Vector3 p2 = new Vector3(length * .5f, -width * .5f, -height * .5f); Vector3 p3 = new Vector3(-length * .5f, -width * .5f, -height * .5f); Vector3 p4 = new Vector3(-length * .5f, width * .5f, height * .5f); Vector3 p5 = new Vector3(length * .5f, width * .5f, height * .5f); Vector3 p6 = new Vector3(length * .5f, width * .5f, -height * .5f); Vector3 p7 = new Vector3(-length * .5f, width * .5f, -height * .5f); Vector3[] vertices = new Vector3[] { p0, p1, p2, p3,// Bottom p7, p4, p0, p3,// Left p4, p5, p1, p0,// Front p6, p7, p3, p2,// Back p5, p6, p2, p1,// Right p7, p6, p5, p4// Top }; #endregion #region Color Color[] colors = new Color[] { Color.red, Color.red, Color.red, Color.red, Color.green, Color.green, Color.green, Color.green, Color.blue, Color.blue, Color.blue, Color.blue, Color.yellow, Color.yellow, Color.yellow, Color.yellow, Color.white, Color.white, Color.white, Color.white, Color.gray, Color.gray, Color.gray, Color.gray }; #endregion #region Normales Vector3 up = Vector3.up; Vector3 down = Vector3.down; Vector3 front = Vector3.forward; Vector3 back = Vector3.back; Vector3 left = Vector3.left; Vector3 right = Vector3.right; Vector3[] normales = new Vector3[] { down, down, down, down,// Bottom left, left, left, left,// Left front, front, front, front,// Front back, back, back, back,// Back right, right, right, right,// Right up, up, up, up// Top }; #endregion #region UVs Vector2 _00 = new Vector2(0f, 0f); Vector2 _10 = new Vector2(1f, 0f); Vector2 _01 = new Vector2(0f, 1f); Vector2 _11 = new Vector2(1f, 1f); Vector2[] uvs = new Vector2[] { _11, _01, _00, _10,// Bottom _11, _01, _00, _10,// Left _11, _01, _00, _10,// Front _11, _01, _00, _10,// Back _11, _01, _00, _10,// Right _11, _01, _00, _10,// Top }; #endregion #region Triangles int[] triangles = new int[] { // Bottom 3, 1, 0, 3, 2, 1, // Left 3 + 4 * 1, 1 + 4 * 1, 0 + 4 * 1, 3 + 4 * 1, 2 + 4 * 1, 1 + 4 * 1, // Front 3 + 4 * 2, 1 + 4 * 2, 0 + 4 * 2, 3 + 4 * 2, 2 + 4 * 2, 1 + 4 * 2, // Back 3 + 4 * 3, 1 + 4 * 3, 0 + 4 * 3, 3 + 4 * 3, 2 + 4 * 3, 1 + 4 * 3, // Right 3 + 4 * 4, 1 + 4 * 4, 0 + 4 * 4, 3 + 4 * 4, 2 + 4 * 4, 1 + 4 * 4, // Top 3 + 4 * 5, 1 + 4 * 5, 0 + 4 * 5, 3 + 4 * 5, 2 + 4 * 5, 1 + 4 * 5, }; #endregion mesh.name = "testbox"; mesh.vertices = vertices; mesh.normals = normales; mesh.uv = uvs; mesh.triangles = triangles; mesh.colors = colors; mesh.RecalculateBounds(); mesh.Optimize(); testbox_renderer.material = new Material(Shader.Find("Particles/Additive")); testbox_renderer.enabled = true; testbox_obj.SetActive(true); } void Update() { if (Time.time - last_time > interval) { last_time = Time.time; Debug.Log("Update. Is on map? " + MapView.MapIsEnabled.ToString()); } float scale = 1.0f; if (MapView.MapIsEnabled) scale = ScaledSpace.InverseScaleFactor; testbox_obj.layer = MapView.MapIsEnabled ? MAP_LAYER : FLIGHT_LAYER; testbox_obj.transform.position = FlightGlobals.ActiveVessel.GetWorldPos3D(); } void OnDestroy() { Destroy(testbox_filter); Destroy(testbox_renderer); Destroy(testbox_obj); } } } The final goal is to create a sphere (i started with a box because it's easier to debug), center it around a celestial body, and apply a custom shader to it. I dont see the object and i dont get any errors. How do i make the object visible?
  3. Made this mods some months ago. Kayak And Air Delivery System:
×
×
  • Create New...