Space game
-
So my previous project stalled and I wanted to make some kind of progress in something. I decided to start another project, this one is intended to be a spaceship game of sorts. I started with the 3D movement tutorial and worked up from there.
Right now I have an arena of sorts and only a block to represent the ship. I've implemented some kind of third person camera which roughly works right now except for one detail, I can turn the camera and move in that direction but can't get the camera to follow properly behind the ship.
I know this sounds hard to understand so I've uploaded the current version and hopefully it should get approved, the code is: NX8LM8NDXG
What I'm going for is for the player to be able to look around with the right stick a certain (but limited) amount and have the ship relatively sluggish in movement but able to fly around with the left stick.
-
Progress! The third person camera works (mostly) now the ship can turn with the camera, fly forward and the camera can also be turned independently by the player to look around. I had to break one feature to make it work but I'll try to get that working again later. I also had height controls working but temporarily turned them off as they need more work and they were in the way.
On to the next problem: The ship can fly in all directions and the camera can look around but the ship flies in whichever direction the camera points, not where the ship points. If I turned off independent control of the camera, it wouldn't be a problem but that's an important feature so I'll have to make it work. Once this part is done, I'll update the upload with these additions.
For now though, does anyone know if there's a way to put the orientation of the ship into an "if" statement? In other words, which function will say where the object is pointing?
-
You could try adding an empty object (e.g. an invisible cube) to the ship a little bit in front or behind and parenting the ship to it. That way, wherever the empty is, that is the direction the ship is pointing.
-
Drawing on the second part of the sprite video tutorial regarding animation states
(state. Idleright for example) you could have if state. Idleright then..
Sorry that's non applicable with 3d sorry -
@DomDom I tried that but couldn't get it to work, but I solved it a different way. The new problem is moving in the direction the ship is pointing, not where the camera is pointing. I have an idea that I'll try later and report back here if it works.
@Maxwello Thanks for sending me those tutorials but I couldn't make sense of them. But it gave me an idea about what the problem was.
-
@Something. We'll it was just an idea. There is always a way. You just have to believe.
-
Yes @DomDom I believed and the coding deities delivered. The camera and ship movement have been successfully separated and now there is free camera movement AND separate ship movement.
Thanks to all for the help to get it working. Pretty much everyone explained the solution multiple times to me but I was being too dense to get it but it suddenly clicked for unknown reasons last night and I had a major breakthrough. Super special thanks to @Tratax who also showed examples of how it's done.
I'll update the the public version when I fix one thing that was broken while getting the third person camera to work, the ship rotation. It's a little off right now but hopefully this should be fixed soon and I can post the download code for the new version shortly.
-
Of course. Even the gods must ultimately bow to dilusional optimism. Congrats!
-
New version is now pending moderator approval, still a few things to work out before I can start getting to the actual gameplay but it is getting there (slowly).
The game ID will now be: NDRM3DNDXG for anyone who wants to have a look. (Feel free to modify your own version from it) I'll try to post a video here for anyone who doesn't feel like downloading it.
Edit: Hopefully everyone can see the video if I posted it right:
-
Haven't done anything for a few weeks but just figured out how to have a kind of "Laser" type thing beaming out from ship. Works right now but need to find a way to prevent the beam from disappearing when the camera pans up or down. After that, I'll need to figure out how to have the beam "collide" with objects and have an effect on them.
Does anyone know how to attach an object to another in such a way that they rotate together as if they are one object and not two separate objects rotating next to eachother?
-
Yes you need to look at this: https://fuzearena.com/help/view/createObjectGroup
-
Also daves Xmas tree vid showed something regarding this
-
Ah, thanks, I think that's what I'm looking for. Will try it and hopefully that does it. I think I actually had that function in the program before but it didn't do what I needed it to do at the time so took it out.
Edit: That didn't do it unfortunately. But I figured out an ugly code to get a similar result.
-
Does anyone know if there's a way to change where a 3D object pivots when rotating? I need something to pivot from its end, not the middle. Or do I have to make an elaborate system of invisible grouped objects to make it move correctly?
-
I have had the most success with object groups to pivot around an arbitrary point. If there is another way, I have not found it, either.
You can have a single object in the group, with the group's origin acting as the pivot point.