clyde

Amateur Game Making Night

Recommended Posts

Try using a mod ( % ) operator. That way -10%360 = 350 and 350%360 = 350;

 

Wow I'll give that a try. That would make things significantly easier. Thanks!

Share this post


Link to post
Share on other sites

I think i just finally made the breakthrough that makes all the sharing values between different objects in unity make sense. I somehow missed that the scripts you attach to an object are considered to be components of that object. So where before I was trying to do Object.Variable to pull in a public value, I actually needed to take Object.GetComponent<Script>() first, and then do Script.Variable.

 

I'm sure it's simple to a lot of folks, but it was an epiphany for me. 

Share this post


Link to post
Share on other sites

Yeah, that took a bit for me too. What took even longer was remembering that you don't put " " around the script name because components don't get them, but finding an object by name or tag do.

Share this post


Link to post
Share on other sites

I don't think this is correct. As long as you're accounting for the varying timestep in the Update method, i.e. use Time.deltaTime your camera movement should be smooth.

 

I had Time.deltaTime so I don't know what went wrong. FixedUpdate was the only Update method that worked for me. I mean I'm probably doing something wrong, but this works! :P Could it have something to do with the fact that I'm moving the player using AddForce/AddTorque? So its movement is running in a FixedUpdate?

Share this post


Link to post
Share on other sites

I had Time.deltaTime so I don't know what went wrong. FixedUpdate was the only Update method that worked for me. I mean I'm probably doing something wrong, but this works! :P Could it have something to do with the fact that I'm moving the player using AddForce/AddTorque? So its movement is running in a FixedUpdate?

As far as I can tell, camera movement logic needs to be in the same kind of Update method as the movement logic of the object you are following, whatever that happens to be. Jitter seems to occur when the movement between target & camera is happening out of sync/on different Update cycles. Rigidbody physics happens on FixedUpdate, whereas if you are manually moving some object manually in code, then it's probably in Update. The right answer will be specific to a particular game.

Share this post


Link to post
Share on other sites

Right! So FixedUpdate it is, for my game. :)

 

So, revised tip: IF you're having trouble with jittery camera follow motion, make sure it's in the same type of Update method as the movement code for the object you're following. Happy now, SpennyDubz?!  :devil:

 

Related question: If my camera following is happening inside FixedUpdate does that mean I can just drop the deltaTime variable? Not that it matters much, would just look cleaner..

Share this post


Link to post
Share on other sites

Hey, my learning is working, I actually sorta understand what you guys are talking about!

 

Slightly peeved that IRC is blocked at work. Although that's probably a good thing for productivity...

Share this post


Link to post
Share on other sites

Hey, my learning is working, I actually sorta understand what you guys are talking about!

I was thinking the same thing.

If I had read this conversation on Monday, I would have skipped it and said "Unity sounds to complicated." Now I'm reading it and saying "Do I have to add the script as a component to every object that I want to pull a value for?" Which may not make any actual sense, but it's the difference between trying to read this gibberish and skipping it.

Share this post


Link to post
Share on other sites

Right! So FixedUpdate it is, for my game. :)

 

So, revised tip: IF you're having trouble with jittery camera follow motion, make sure it's in the same type of Update method as the movement code for the object you're following. Happy now, SpennyDubz?!  :devil:

 

I'm happy, I'm learning too!

Share this post


Link to post
Share on other sites

Ok. A sketch has been drawn of a track for prototyping this Micro Machines-like.

 

BgXLcyhCQAAuCfT.jpg

 

Now onto actually modelling it.

Share this post


Link to post
Share on other sites

Is anyone here able to help out with music by any chance?

Can you be a bit more specific?

Share this post


Link to post
Share on other sites

Well I've made a little game for the last Ludum Dare and I'd like to polish that up and add more content. You fly a spaceship through a factory, and having some music for that would be great. It adds a lot of atmosphere after all.

 

 

It can be found here.

 

Share this post


Link to post
Share on other sites

Record yourself humming/lalaing what you would like to have and post it here. Some inspiration like.

Share this post


Link to post
Share on other sites

Record yourself humming/lalaing what you would like to have and post it here. Some inspiration like.

 

I have really no idea what would fit the best, that's why I posted the link to the game. Maybe that helps with the inspiration? The post-compo version already contains a track that a friend made really quick, but I am by no means bound to that style (The track is somewhat dubstep-y because that's what he knew the best)

Share this post


Link to post
Share on other sites

So, revised tip: IF you're having trouble with jittery camera follow motion, make sure it's in the same type of Update method as the movement code for the object you're following. Happy now, SpennyDubz?!  :devil:

 

As an addendum, if you have the movement code in Update, but the kind of movement you are doing is to AddForce to a rigidbody, the rigidbody is secretly actually doing its physics calculations/movements in its own FixedUpdate, so that's where you want your camera follow code.

I don't know any of this for sure, but it's what I've discovered through extensive trial and error.

 

I don't know if you could get rid of deltaTime, I would guess not, but try it and see.

Share this post


Link to post
Share on other sites

I've started following that scrolling shooter Unity tutorial someone linked and it's been great actually getting a vague understanding of how Unity, hopefully I'll learn enough to actually start making something and not lose interest before even really starting like other times I've tried making  a game.

Share this post


Link to post
Share on other sites

I've started following that scrolling shooter Unity tutorial someone linked and it's been great actually getting a vague understanding of how Unity, hopefully I'll learn enough to actually start making something and not lose interest before even really starting like other times I've tried making  a game.

I'm doing the same thing. I started with the ball rolling one which is super simple but helpful. Definitely worth just supplementing with some wider reading so you understand more about how C# works!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now