dark        
Osc blog header photo
Osc's c-blog
Posts 1136Blogs 35Following 0Followers 13


 
 

LONG BLOG

Game In Progress: September 2020

   0

Blog header

Short one again. But, hey - progress is progress, no matter how small.

Last time, I was researching if it was possible to load a shape and control it from one script rather than create a script for each individual object. I was leaning yes, and after successfully doing this with one object, I'm thinking I will be able to do it.

I had successfully spawned my shape onto the scene. Pretty exciting! Considering that my knowledge of programming has been pushed way back in my head, this is practically a miracle. After a quick refresher and finding relevant posts about my issues, I was on my way.

Previously, my code looked like this.

Previous code

Unfortunately, this was not right. My issue at the time was figuring out the syntax for rotating the object to see the different sides of the shape. I thought my problem was that I was using the wrong code to move the object, but it was actually my initial code.

As you can see above the Instantiate code does in fact make my shape appear. But that's it! When I tried to use my 'shape' variable to rotate the shape being spawned, nothing happened because that variable wasn't actually referencing anything. This is one of the first and most basic concepts you learn in programming. Oopsies. See what I mean by needing that refresher?

So after that palm-to-head smacking incident, I fixed it. Now it looks like this.

Updated code

In one line, I am referencing my shape, and in the other I am making it appear and getting it's rigidbody component. The rigidbody is essentially what gives it physics. That's another thing I needed to do: update all my shapes to have this physics component.

Then, I updated my code for the inputs and rotations.

Updated code for inputs and rotations

Afterwards, I did a simple test to make sure the objects move. And they did move, but it's not the way I want them to move. I need them to rotate based on the view of the user. Right now, I think they are rotating simply based on their own location in the world. So it's not technically a bug, just needs an update change.

And that's my progress for September. I will be doing a bit more develpment after posting this for October's progress update. It feels good seeing things click and come together little by little!

Login to vote this up!

LOOK WHO CAME:


Osc   


 
 

  0 COMMENTS

Please login (or) make a quick account (free)
to view and post comments.



 Login with Twitter

 Login with Dtoid

Three day old threads are only visible to verified humans - this helps our small community management team stay on top of spam

Sorry for the extra step!

 

About Oscone of us since 9:37 AM on 11.12.2011

Here to play games and make the funnies.
My twitter: https://twitter.com/oscmolo