Unity Help

General Discussion on the Unity Engine.
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Unity Help

Post by SpiritWebb »

I dont know how many people on the forums have played with it a lot, but I am needing some help...done some searching and cant find anything, unless I have missed it.

So I created the space scene, sun and planet, have my FPS in as well, now when I run the game, it won't move (fly in this case) it just sits there. But if I create a new game, add in a terrain, etc, etc...drop the FPS in and it walks, no problem.

Any help getting this to work would be great! Thanks in advance...

(Note: using the standard FPS controller that comes with Unity, and have not changed anything in the script. Though in the Insepector Panel I changed the gravity to zero, and the speed to 25.)
Image

Image
towcar
Posts: 316
Joined: Wed May 20, 2009 2:16 pm

Re: Unity Help

Post by towcar »

Do you think zero gravity is not the answer?
Try making the scene so you can run in it first. Then once that works make the simple change to do flying.

Personally I don't think you can use the fps script to fly, you'll probably need changes to it or a new script.

Just because you have zero gravity, I think it depends how your physics is implented in it, because the fps I don't beleve has great physics, which is why lots of people use the rigid body.
Image
User avatar
Sakar
Posts: 520
Joined: Thu Apr 23, 2009 2:59 am

Re: Unity Help

Post by Sakar »

The problem is that the script checks to see if you are colliding anything and only let you move if you are.

This is what my script looks like in one of my games. It does not detect for collision (but it probably wouldn't be hard to do)

Code: Select all

var speed = 6.0;

function FixedUpdate() {
	
	var controller : CharacterController = GetComponent(CharacterController);
		if (Input.GetButton("Forward") && !Input.GetButton("Backward")) {
			var forward = transform.TransformDirection(Vector3.forward);
			transform.Translate(Vector3(0, 0, speed) * Time.deltaTime, Space.World);
		}
		if (Input.GetButton("Backward") && !Input.GetButton("Forward")) {
			var backward = transform.TransformDirection(Vector3.forward);
			transform.Translate(Vector3(0, 0, -speed) * Time.deltaTime, Space.World);
		}
		if (Input.GetButton("Left") && !Input.GetButton("Right")) {
			var left = transform.TransformDirection(Vector3.right);
			transform.Translate(Vector3(-speed, 0, 0) * Time.deltaTime, Space.World);
		}
		if (Input.GetButton("Right") && !Input.GetButton("Left")) {
			var right = transform.TransformDirection(Vector3.right);
			transform.Translate(Vector3(speed, 0, 0) * Time.deltaTime, Space.World);
		}
}

@script RequireComponent(CharacterController)
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Unity Help

Post by SpiritWebb »

I got it too work, had to write a whole new code for it. But someone over at Unity Forums gave me their code. The only problem that came up with it is, I don't understand how to create custome input buttons. Do you have to rename the ones that you dont plan on using, ie. jump or can you make new ones?

Either way at this point I got it too work...just need to add more light to the scene. It is in First Person and eventually I would like to move it too a 3rd person. I will be building off of this test file as I go, to better understand Unity.

Thanks Sakar for the code.


Towcar: I read that even when placing zero gravity, its still considered freefall, and the FPS controller will not work. So you were right, a new script had to be made.
Image

Image
User avatar
Sakar
Posts: 520
Joined: Thu Apr 23, 2009 2:59 am

Re: Unity Help

Post by Sakar »

In Edit > Project Settings > Input change the "Size" property to a bigger number. This will create more controls that you can use.
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Unity Help

Post by SpiritWebb »

Alright, so I am having another problem.

My question is, how to do a custom HUD. Similar to this...

Not exactly, but enough to get the idea. I cannot find the pic on how I really wanted it...but, using the layout.

Top Left - View Screen (Feature later to be implemented)
Top Right - Player stats/info
Bottom left - Map of current system (can be clicked to enlarge for better view, with another option to show the current galaxy maps)
Bottom right - Chat system

Any help with this would be greatly appreciated...
Image

Image
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Unity Help

Post by SpiritWebb »

I have a new question.

I have created a nebula using the particle system...I unfortunately don't know how to enlarge the particles to make them space much larger, to create the nebula effect...right now its like a smoke ball...

Does anyone know how to enlarge the particle system?
Image

Image
towcar
Posts: 316
Joined: Wed May 20, 2009 2:16 pm

Re: Unity Help

Post by towcar »

Trying to think of how to say the right terms

Ok, lets say you threw these particles into the game. Then on the window on the side that says all the assets that are ingame there should be that particle. Click on it and info should pop up on the side. In that window click on the > arrow besides the word transform.
Then change the scale size, that is a guess of my head, I'm currently figuring out stuff with code and advanced gui.... fun :P
Image
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Unity Help

Post by SpiritWebb »

I ended up getting it to enlarge dramatically, now it just looks like a big LIGHT BALL...and not a nebula...take a look at my new screens on the project tier 1, Undiscovered Online...you will see the nebula... :?
Image

Image
towcar
Posts: 316
Joined: Wed May 20, 2009 2:16 pm

Re: Unity Help

Post by towcar »

Why don't you try and increase by decimal?

instead of 1, 2, 3 go 1, 1.01, 1.02, 1.03

That should make it increase less.
Image
Post Reply

Return to “General Unity”