Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Problem with 'milkshape model' that I made..

Author
Message
Bubba
Reviewed AGK on Steam
13
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 12th Mar 2018 21:27 Edited at: 12th Mar 2018 22:00
This little model is for an experimental game I'm making. My plan is to 'mount' the AppGameKit 'camera 1' to one of the spheres.
However, I need to know the 'id #' of the middle sphere so I can proceed. This model supposidly has 3 children... a plane and 2 spheres.
I didn't put any joints on the model, but when I load it on AGK2 it looks fine and has all the parts attached.
So, maybe I'm supposed to put joints on the model? It's a fixed model anyway, so I don't need any joints on it anyway, I don't plan on moving the individual parts on it.

Attachments

Login to view attachments
Bengismo
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 12th Mar 2018 23:21 Edited at: 12th Mar 2018 23:26
Firstly, there are no children in your model at all. Its just one single mesh with no children.

Secondly, Milkshape files dont load up with children to my knowledge. They load up as separate meshes and that is when you correctly allocate bones and materials into the model within milkshape etc...

What you can then do is play an animation on the model and get various parts moving relative to others. The meshes are the children.

Anyway, back on topic. If you want to mount the camera on one of the spheres then you can simply move the camera to the kite objects location and rotate it to be the same rotation as the object then move the camera back along its local z axis. This way the camera always follows the object at a set distance behind.

If you REALLY want to follow the sphere or use it as your camera mount position, then allocate a bone to it in Milkshape then offset the camera with the bones location. Use theGetObjectBoneWorldX,Y,Z() and these give where the bone is in the world and you can also get the bones angle with GetObjectBoneWorldAngleX,Y,Z



So basically I took your model, added bones and added animation of the rear sphere to move it about a bit like a fish flapping its tail. The rear sphere is attached to bone no6.
I then did a real quick program to show the animation playing and the bones location in 3d space (printing out its location.
You would simply use those coordinates as the camera position to animate the camera postion by playing an animation.
Bubba
Reviewed AGK on Steam
13
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 13th Mar 2018 05:40 Edited at: 13th Mar 2018 17:32
Do you have the animation that you made so I can try it?

So, I could use a 'bone sphere'? Then the AGC will be able to detect it as a child, and then mount the camera on the bone sphere (location) and set camera to 'look' at the object, right?

GarBenjamin
1
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 13th Mar 2018 16:34 Edited at: 13th Mar 2018 16:35
There are different ways to actually implement it and is up to you.

One way would be to simply move the camera to the same position as your object then setcamerarotation to be 0,objectYangle,0 so it is facing the same way then move camera local z by a set negative distance. That will push the camera behind the object. Next move camera local y some positive amount to move it up (or however you want it offset). Finally set camera to look at the object. This will make it so the camera is always following the object looking at it.

Then you can tackle the camera view to object being obstructed... cast a ray from camera to object if result is not id of your object something is in between and you can adjust camera accordingly perhaps moving camera closer or higher until view is no longer obstructed.

Sorry for typos am writing this on cell phone.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Bengismo
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 13th Mar 2018 16:54
@Garbenjamin I suggested the same thing above.

BenGismo wrote: " You can simply move the camera to the kite object's location and rotate it to be the same rotation as the object then move the camera back along its local z axis. This way the camera always follows the object at a set distance behind."


It doesnt get any easier than that

Bubba
Reviewed AGK on Steam
13
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 13th Mar 2018 17:08 Edited at: 13th Mar 2018 17:22
Thankyou, I am going to give it a try... I would have to match the angle of the camera to the angle of the object, and then set camera 'look at object', and maintain the same 'following distance' at all times.

Camera will be following the object at a 'right angle' at all times.


GarBenjamin
1
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 13th Mar 2018 17:08 Edited at: 13th Mar 2018 17:18
@Bengismo ah sorry I didn't see that. Only saw your post about using a sphere and they had asked after that if there was a way to do it without needing the sphere (or at least I interpreted it that way lol) so figured nobody had covered that.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Bubba
Reviewed AGK on Steam
13
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 13th Mar 2018 17:25 Edited at: 13th Mar 2018 17:27
Yes, without using the sphere would be better, because if a simple coding formula would accomplish the same thing.... why not? Thanks, I will try that,.

Login to post a reply

Server time is: 2018-10-17 11:25:18
Your offset time is: 2018-10-17 11:25:18