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 / Why is this ball flying up?

User Offline
Joined: 2nd Mar 2017
Posted: 29th Dec 2017 00:51
This is really very noob question I must have missed something really simple, but - why is this sphere flying up? I thought that it should stand still or, at most, fall down to the plane. Why doesn't it stop at the upper plane, but after some jerks continues going upward?

+ Code Snippet

Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 29th Dec 2017 15:46
I've never used the slide commands, and I'm new to 3D, but I guess it's because the sphere is too close to the plane to run an ObjectSphereSlide with a radius of 10, so you get unwanted values.

I replaced 10 by 2.8 in the following line, and it works:
if ObjectSphereSlide(0,oldx#,oldy#,oldz#,newx#,newy#,newz#,2.8)>0

Coders don't die, they just gosub without return
User Offline
Joined: 2nd Mar 2017
Posted: 30th Dec 2017 10:28
It's not the matter of the planes, because if you comment them out it still goes up like crazy Looks like it checks for collision with itself or just magic Yes, radius set to 2.8 works, but why? It can't be that I'll have to manually look for radius each time I'll want to load an object
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 30th Dec 2017 13:29
The code doesnt make a lot of sense to me. What are you trying to do??

Your code checks for a collision between the sphere you have created (ID someSphere) and a sphere that is cast into the scene of radius 10 at the exact same position as your sphere. So they ALWAYS collide as one is in the SAME location as the other. The sphere cast then suggests a new set of position variables so that they dont collide which you assign as new position. The collision between your spherecast and the sphere you created is moving the sphere. (your spherecast is chasing your sphere out of the scene )

Its not just the Y that varies, the X and z do too by a smaller amount.

If you dont want your sphere cast into the scene to collide with your object sphere then turn off its collision
SetObjectCollisionMode(someSphere,0) // this is to stop it interfering with the collision with the shpere cast into the scene
User Offline
Joined: 2nd Mar 2017
Posted: 30th Dec 2017 20:46
I'm trying to make a simple game that takes place in my home town. I Imported a map from OpenStreetMap to Blender and then exported into an .obj file and put a human figure into it. I extracted this piece of code trying to pinpoint why this object behaves this strange way. Thanks for your answer, it explained all that I thought is magic I'm going back to learning now


Login to view attachments
User Offline
Joined: 12th Nov 2017
Location: Spain
Posted: 31st Dec 2017 18:48
The problem seems related with the SetObjectPosition. You need to pass the offsets instead

+ Code Snippet

Happy new year

Login to post a reply

Server time is: 2018-01-23 02:00:58
Your offset time is: 2018-01-23 02:00:58