Jump to content

[WIP] KerbTown v0.13 Beta - Place static buildings, cities, launch sites & more!


Razchek

Recommended Posts

Please...someone tell me what Im doing wrong...

Wrf3Yn4.png

The texture does not look like that in Blender or Unity. Figured it would be simple to make a basic road kit, and this texture issues is killing it.

edit: And yes, despite how easy it is to place objects now, that is another smashed rover in the pic...what can I say, I gots skills! =P

Link to comment
Share on other sites

So, I made a trip to Mun this morning, found the cave :) heres a short video of the outing!

started a new save for it, so scratch built ship and a fresh clone of Jeb

At the time of this posting there are 2 hours left to upload the video. I'm off to bed now just wanted to get it posted :)

Link to comment
Share on other sites

The texture does not look like that in Blender or Unity. Figured it would be simple to make a basic road kit, and this texture issues is killing it.

If you mean the grey edge: In the Blender UV editor, see if you have part of your UV hanging off the side of the texture. If you do, what is probably happening is that in Blender, and evidently Unity, your texture is repeated over and over like a tile floor, so UVs hanging off the left side of one tile will be getting part of their texture from the right side of another tile. If KSP does not do this, like I suspect, in game that part of the texture will just be missing, and you have to go back and move the UVs onto a single tile.

If you mean the stretched gravel, that is a UV scaling issue, and you would have to make the UV for that face bigger (usually) to correct it. You can overlap UVs though, that won't hurt anything at all. I do it a lot to make sure I get identical features. It could also be that it's a little distorted on the UV map too.

Link to comment
Share on other sites

Ah ok, i did have UV maps hangign off the texture, so that explains the washout.

The stretched gravel I'm still unsure of. The uv map for that bit was full on the texture, and it looked just like whats on top in Blender/unity. But squished in KSP

Link to comment
Share on other sites

Ah ok, i did have UV maps hangign off the texture, so that explains the washout.

The stretched gravel I'm still unsure of. The uv map for that bit was full on the texture, and it looked just like whats on top in Blender/unity. But squished in KSP

You might fix both at the same time. You just have to make the UV for that face bigger if not, if it gets too big you have to split that face again, which will split the UV, and then you will be able to overlap the UV as needed.

Also, granted, I've only been playing KSP about a month now.... But that is the coolest lander I have ever seen HoY.

Raz, you do not leave much to test... I can't find a way to break this thing so far :(

I do have a question though, but I still need to DL latest, so maybe pointless question. Why are there 4 axis... axises... whatever... 4 ways to move the thing around? Shouldn't it just be x, y, altitude?

Link to comment
Share on other sites

We need people to test out scripted events :)

Make a building with an elevator platform that takes you to the roof when you step on it.

Once that's done, make a building that has a space elevator that goes all the way to space when you step on its platform :D

Make a drive in theater, parking lot with a big LightSwitch plugin powered screen that actually plays a YouTube channel or some other online media type

A sky car or ski lift type cable car that takes you from the KSC to a lodge in the mountains north of town.

A monorail to the other side of the continent that leads to a cruise ship that leads to another monorail all to the other Space Center. All activated via proximity when you board them.

Anything that can move and influence a kerbal is pretty much possible

Link to comment
Share on other sites

We need people to test out scripted events :)

Make a building with an elevator platform that takes you to the roof when you step on it.

Once that's done, make a building that has a space elevator that goes all the way to space when you step on its platform :D

Make a drive in theater, parking lot with a big LightSwitch plugin powered screen that actually plays a YouTube channel or some other online media type

A sky car or ski lift type cable car that takes you from the KSC to a lodge in the mountains north of town.

A monorail to the other side of the continent that leads to a cruise ship that leads to another monorail all to the other Space Center. All activated via proximity when you board them.

Anything that can move and influence a kerbal is pretty much possible

Would you be able to point me towards some more information on how to do this?

Link to comment
Share on other sites

Lol not me :) I only know its possible because I've been pm'ing Raz. I know nothing about programming or modeling, I'm more of an idea man LOL

i can tell you he's planning on putting out a few more demo-type releases to show some more of the capabilities, in the hopes that once people see the basics they can take it from there. After all, this plugin is ultimately for the user base to upgrade the Kerbol system :)

Link to comment
Share on other sites

For this update, I have added module support and fixed a couple of minor bugs.

So does this only only apply to LightSwitch modules???

I had assumed it was the possability of all modules, hence my earlyer question.

Mainly Im interested if the EL or animategeneric/fsanimate work.

Alot of my ideas require a kerbal activated animation, now it kinda sounds like the LightSwitch mod is only way to do that

Link to comment
Share on other sites

So does this only only apply to LightSwitch modules???

I had assumed it was the possability of all modules, hence my earlyer question.

Mainly Im interested if the EL or animategeneric/fsanimate work.

Alot of my ideas require a kerbal activated animation, now it kinda sounds like the LightSwitch mod is only way to do that

Nothing to do with LightSwitch. :P

The modules that can be attached are more or less 'raw'. What I mean by that is that if you're a decent programmer, you can make the modules do anything you would like.

E.g. If you made a script in Unity that makes a rigidbody bounce up and down on a trampoline-like object for example, you could port that to this and just changing the code as necessary to find the object to bounce. :)

PartModules can take a lot of work to get working and it would be easier to simply create a second class of the original module and edit what is needed. I did this with the ReflectiveShader plugin and changed lines that made references to 'part'.

After I make a framework for a context menu it will make interaction more intuitive. At the moment the easiest solution for interaction would be to use collision triggers IMO.

Edit:

I understand a lot of people will want to use Animations on their creations and if they can program it is as simple as writing the script for it.

Without the context menu how-ever it wouldn't be easily achieved for someone who isn't a programmer (Unless you wanted the animation to play continuously without interaction).

Further on the subject, if we wanted to use modules from KSP natively it would mean I will need to add Vessel and Part components to the static objects.

At the moment it's not possible to stop the events that occur from these (FixedUpdate, for example), which will cause an overhead that no one wants.

I do want to make this as accessible to all content creators as possible of course, not just programmers. So just sit tight my man, I'll see what I can come up with! :)

Edited by Razchek
Link to comment
Share on other sites

PartModules can take a lot of work to get working and it would be easier to simply create a second class of the original module and edit what is needed.

That kinda depends on who ya are bud =P

Guess Im stuck with full static for now...I'm not a crappy programer, let alone a decent one haha!

Link to comment
Share on other sites

For now, you can have the animation play automatically? :)

Just set them up to have a delay at the needed places.

--

Edit:

Just for some laughs and to help out people learning to use KerbTown - I made a very quick cannon to fire Kerbals (and other stuff).

Code for the module/library:

using System.Collections;
using System.Linq;
using UnityEngine;

namespace CannonOfWhoosh
{
public class CannonModule : MonoBehaviour
{
public Transform TravelPath;

private void Start()
{
// Script is added to the root GameObject (in this case; KSPCannonExample)
//TravelPath = transform.root.GetComponentsInChildren<Transform>().FirstOrDefault(t => t.name == "TravelPath");
TravelPath = GetComponentsInChildren<Transform>().FirstOrDefault(t => t.name == "TravelPath");

// If we still can't find it then we should know about it.
if (TravelPath == null)
{
Debug.LogError("Could not find the TravelPath GameObject.");
}
}

private void OnTriggerEnter(Collider otherCollider)
{
if (TravelPath == null || otherCollider.name == "DestructionCollider")
return;

Rigidbody rigidBody;
if (!(rigidBody = otherCollider.transform.root.rigidbody)) return;

print(otherCollider.name);

StartCoroutine(LaunchEm(rigidBody));

Debug.Log("Launched!");
}

IEnumerator LaunchEm(Rigidbody rigidBody)
{
rigidBody.velocity = Vector3.zero;
rigidBody.angularVelocity = Vector3.zero;

yield return new WaitForSeconds(0.2f);
rigidBody.isKinematic = true;

yield return new WaitForSeconds(0.2f);
rigidBody.gameObject.transform.root.position = TravelPath.position;

yield return new WaitForSeconds(0.2f);
rigidBody.gameObject.transform.root.rotation = TravelPath.rotation;

yield return new WaitForSeconds(0.2f);
rigidBody.isKinematic = false;

yield return new WaitForSeconds(0.2f);
rigidBody.AddForce(TravelPath.forward*1000, ForceMode.Impulse);
}
}
}

Config for the cannon:

//  Generated by KerbTown - Hubs' Electrical

STATIC
{
name = cannonExample
module = Part
author = Hubs
static = true
mesh = ThisBeYourCannon.mu
scale = 1
rescaleFactor = 1
cost = 0
category = none
subcategory = 0
title = Epicosity
manufacturer = Hubs Manufacturing Ltd.
description = BOOM
attachRules = 1,1,1,1,0
mass = 1
dragModelType = default
maximum_drag = 1
minimum_drag = 1
angularDrag = 1
crashTolerance = 1
maxTemp = 1
breakingForce = 1
breakingTorque = 1
MODULE
{
namespace = CannonOfWhoosh
name = CannonModule
}
Instances
{
RadialPosition = 159577.7,-1107.322,-578454.8
RotationAngle = 0
RadiusOffset = 82.45
Orientation = 0,1,0
VisibilityRange = 1000
CelestialBody = Kerbin
}
}

Unity Hierarchy:

|-KSPCannonExample - Has the Part Tools script attached.
->
|-- InductionCannon - This name is a lie but that's okay. <3
-->
|--- Cube - This is the floor with a mesh collider (it has a slope at one end for smooth stepping).
|--- Cylinder - This is the barrel, so to say - nothing more than a hovering hollow cylinder with a mesh collider.
|--- TravelPath - This is an Empty GameObject, the blue arrow determines the firing direction. The position determines the ammunition starting point (centered but positioned before the start of the barrel)
|--- TriggerSpot - This is an Empty GameObject with a primitive collider, isTrigger is set to true. I used a sphere collider in this example with a radius of 0.5

Because this object only has a single collider with isTrigger you do not need to find the GameObject "TriggerSpot" first and add the script there.

If it had multiple colliders you would simple create another class in that same namespace and add that class as the component to the appropriate GameObject.

I'd like to see if anyone else has tried playing around with the modules yet? :)

Edited by Razchek
Link to comment
Share on other sites

I am getting this in the log, along with several other problems with the plugin in game that this is obviously the cause of. (Not grabbing Celestial body for new object, or coords of object trying to spawn them for example). Manually instancing and object doesn't seem to work either.... But I haven't worked out yet if maybe the KSC has moved or I have it inside one of the new buildings, lol.

[WRN 23:15:11.919] Cannot find preset 'Low' for pqs 'Eeloo'
[WRN 23:15:11.931] Cannot find preset 'Low' for pqs 'Pol'
[WRN 23:15:11.988] Cannot find preset 'Low' for pqs 'Dres'
[LOG 23:15:13.743] [PlanetariumCamera]: Focus: Untitled Space Craft
[LOG 23:15:13.878] Flight State Captured
[LOG 23:15:13.878] Saving Achievements Tree...
[LOG 23:15:13.879] Saving Achievements Tree...
[LOG 23:15:13.898] Game State Saved as persistent
[WRN 23:15:13.899] [HighLogic]: =========================== Scene Change : From TRACKSTATION to FLIGHT =====================
[EXC 23:15:14.257] KeyNotFoundException: The given key was not present in the dictionary.
[LOG 23:15:15.300] AddonLoader: Instantiating addon component 'KerbTown' from assembly 'Kerbtown, Version=0.4.4954.4667, Culture=neutral, PublicKeyToken=null'
[LOG 23:15:15.333] ------------------- initializing flight mode... ------------------
[LOG 23:15:15.358] Target vessel index: 4 vessel count: 5
[LOG 23:15:15.360] [FLIGHT GLOBALS]: Switching To Vessel Untitled Space Craft ----------------------
[LOG 23:15:15.363] setting new dominant body: Kerbin
FlightGlobals.mainBody: Kerbin
[LOG 23:15:15.366] Reference Frame: Rotating
[LOG 23:15:15.389] [Untitled Space Craft]: landed - waiting for ground contact to resume physics...
[LOG 23:15:15.393] Camera Mode: AUTO
[LOG 23:15:15.396] stage manager resuming...
[LOG 23:15:15.398] all systems started
[ERR 23:15:15.440] KerbTown: Could not obtain CelestialBody component from: Kerbin
[EXC 23:15:15.442] FieldAccessException: Field `LODRange:isActive' is inaccessible from method `Kerbtown.KerbTown:InstantiateStatic (PQS,Kerbtown.KerbTown/StaticObject)'

Link to comment
Share on other sites

Thank you Cheebsta!

KerbTown has been updated to now support KSP version 0.21.

Planned features for next update:

Generic Animation Modules

Two are being tested and improved at the moment:

1. Collision based triggers. - Things your vessel should collide with/through to activate animations (events).

2. Mouse click triggers. - Things that you can click with your mouse on screen to activate animations (buttons).

At the moment to add a script to a static object you just add the following to your static object config:

MODULE
{
namespace = YourDLLNamespaceName
name = YourDLLClassName
}

The new modules will be configured as such:

Collision triggered animations:

MODULE
{
namespace = KerbTown
name = AnimateOnCollision
collider = collisionTriggerObject // The name of a [empty] GameObject containing a collider with "isTrigger" set to true from within Unity3D.
animationName = YourAnimationName // The name of your Animation as specified in Unity3D.
}

Mouse-click triggered animations:

MODULE
{
namespace = KerbTown
name = AnimateOnClick
collider = collisionTriggerObject // The name of a GameObject containing a collider [with "isTrigger" set to true] from within Unity3D.
animationName = YourAnimationName // The name of your Animation as specified in Unity3D.
}

For example;

You are designing an elevator and you need to be able to make the elevator go up and down only when interacted with (not automatically).

You have two native approaches, I'll only go over one for now:

In your elevator design, add a GameObject into the hierarchy in Unity3D called "MyFirstButton". This GameObject should obviously be a descendant/child of the root GameObject that has your KSPPartTools component attached.

Setup your animation as you normally would, taking note to remember the animation name; for this example we'll call that animation "ElevatorMove". Export the object as your normally would for KSP.

Now you've done that, you just need to add some information to your config.

Remember that your button object was called "MyFirstButton" and the animation was called "ElevatorMove".

MODULE
{
namespace = KerbTown
name = AnimateOnClick
collider = MyFirstButton
animationName = ElevatorMove
}

Now, when you use your mouse in game to click the button you placed it will react by playing the animation! :)

I will post more information later.

Was that easy to follow, or is it hard to understand?

Please let me know - I will start writing some documentation after I have the next update out and I'd like to try to make it as easy as possible to understand.

Edited by Razchek
Link to comment
Share on other sites

This is an interesting mod. I'm curious to know if there are plans to be able to add new structures to running save files - domes, buildings, launchpads etc. The game becomes Kerb City!

Link to comment
Share on other sites

This is an interesting mod. I'm curious to know if there are plans to be able to add new structures to running save files - domes, buildings, launchpads etc. The game becomes Kerb City!

You can already add structures with this plugin =P

But better than 'kerbcity' because you dont have to worry about sewage, trash or fires(not in the building at least...)

Link to comment
Share on other sites

Thank you Cheebsta!

Thank you for the speedy fix :)

Was that easy to follow, or is it hard to understand?

Please let me know - I will start writing some documentation after I have the next update out and I'd like to try to make it as easy as possible to understand.

Easy to follow, and very good feature. That should make interaction a cinch.

Edit: On latest I am pulling a Null Reference Exception in the log now going out to Spaceport view with a static placed in the vicinity. Still working out more specifics, but... It looks really cool.

Leaving this for the cool picture, but disregard the error, fixed by erasing the old instances out of the configs.

Bonus extra awesome: They show up on .21 Spaceport view!

Edited by Cheebsta
Link to comment
Share on other sites

Funky! Glad you were able to fix it manually, this shouldn't happen with the latest update.

If it does, output_log.txt from KSP_Data would make me a happy man. :P

Version 0.06b is available now.

Additions include:

- Module support for generic animations (buttons and triggers)

- Rigidbody module support for parts that are animated (KSP Part Tools does not export rigidbody components).

Moving parts should always have a rigidbody. So please take care to add those if you're moving or rotating something with animations (for example an elevator platform).

RIGIDBODY 
{
name = gameObjectNameThatMoves
}

I will be writing some documentation up shortly and will post that when it's ready. Until then please ask if you're unsure of something. :)

Link to comment
Share on other sites

I look forward to seeing your city rasheed!! :D

I have added a manual to the initial post and is included with downloads from now.

Mother of god that took far too many beers to write. :confused:

Please give me feedback fellows. <3

Link to comment
Share on other sites

I can't wait for this, could you also add a house or apartment with an interior for your main Kerbal to 'live' in?

It would be so damn cool if you start in your house, go outside step in your car drive through the city to KSC, go inside your rocket and be 2 years gone to Duna.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...