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.

AppGameKit Classic Chat / [SOLVED] 3dphysicsmass() is it even working??

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Apr 2019 18:02
it seems when I use set3dphysicsmass() on physics body enabled objects then my whole engine knacks up,not using it and leaving it based on object size and everything is fine,the objects in question are spheres set to 6 radius and boxes set to 6x6x6, I have used getobject3dphysicsmass() on said objects just to make sure i have correct values and in the latter cases they should have/and accept a mass of 5!

though it may be my engine,if someone could show me a working example of using mass!!
Hail to the king, baby!

The author of this post has marked a post as an answer.

Go to answer

Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 10th Apr 2019 20:00
You can only set the mass of dynamic objects.
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Apr 2019 20:26 Edited at: 10th Apr 2019 20:51
they are dynamic! As I said if i dont set it then everything is fine




have manually printed out type vars and they are as expected..
if I rem out line 8 everything seems to work..yet when i check out the value it is how i set it!
Hail to the king, baby!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Apr 2019 21:20
not sure what the exact issue your having here

but setting the physicscansleep to 0 is great if your using your own commands to manipulate the object
sometimes there are issues with the physics scale factor so create3Dphysicsworld(scale) with a higher value
can help sometimes

but if its crashing that's some other issue and needs to be handled differently

I found in my krazygrandprix the following two lines caused crashing on my mobile but not html or windows

the strange thing was I could do that with other objects just not the grandstands maybe a physics amount problem

theres lots of other things that can cause problems if you are one of the lucky ones with AppGameKit studio you could add
some watched variables and step through code

also posting how you set up your physics objects in full might help, it may just be that somethings getting set to a
wrong variable or something.

I hope that helps
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Apr 2019 21:30 Edited at: 10th Apr 2019 21:43
well..

it all seems to work if i dont use set3dphysicsmass() !!

Within the editor coded I can also set gravity and also the physics world scale!

the variables i have checked and double checked, I use edit boxes,i have an editbox called massbox, a var called mass is tied to this box,when i place an object then the type object[objectcounter].mass=mass,in fact all fields are set to their current vars like so


even if i default the mass var to 5 and not even use the editbox,it makes no odds!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Apr 2019 22:56
I will get the hang of agk studio debugger and investigate as far as i can!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Apr 2019 11:55 Edited at: 11th Apr 2019 12:45
okay I took time out to learn the debugger,was not too scary, it simply confirmed that there aint anything wrong with my data,after adding a watch on objectl[0].mass then placing an object, which start at index 0 in the array, I tab out and break,this gives me the value:



And correctly it says 100 as I had changed it in the editbox from 1!

So I am still puzzled as to why it aint setting the mass properly, not until i rem out the set3dphysicsmass() do they get one!!



The error messages are just bitching about png size,dunno why coz i am pretty sure i made sure they are power of 2!! but anyhow has zero to do with da problem at hand!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Apr 2019 12:09 Edited at: 11th Apr 2019 14:58


So on running the level it should be the same!which it is I know the other values are ok coz i get a continues bounce when setting restitution to 1.0,under
correct gravity conditions that is!



That is without manually setting the mass,if i was to set it manually,you would see them pause when hitting ground,then drop straight through!
even if i set the mass to the value agk spits out using get3dphysicsmass()
I know phybody is set ok else the whole physics wouldnt work whatsoever!

Within the editor I can set the world physics step and the gravity Y value,in the above demo these are set to 10 and -7 respectively
This brings me to another observation, after a while of slowly gaining height,all of a sudden,but i think always a constant time..., the ball(s) will simply lose everything and seemingly reset to their starting values!! the damping is set low.. 0.001 actually!! friction for ground and balls is 0.7.... and of course restitution for both is 1.0... but i would expect gradual loss anyhow... of course this is all with setting the physics to never sleep,else the balls simply wouldnt get to bounce even once!!
the objects used are created with AppGameKit code, native sphere and box commands!
Hail to the king, baby!
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 11th Apr 2019 16:54
Quote: "Within the editor I can set the world physics step and the gravity Y value,in the above demo these are set to 10 and -7 respectively"


You can not set the 3D Physics world step so I think you are mixing up which physics commands work together.
Also setting the mass to a large number will cause strange effects.
Please create a small simple demo to demonstrate the problem so we can test.
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Apr 2019 17:08 Edited at: 11th Apr 2019 17:18
sorry i meant size! create3dphysicsworld(size)

I got step in my brain today from using the debugger!!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Apr 2019 13:21 Edited at: 14th Apr 2019 17:12
This post has been marked by the post author as the answer.


did this demo only to realize it was error in my logic,but here is h demo anyhow,yeh everything is fine, I wasnt setting the mass of the terrain to reflect its scaling!

in the demo the red ball doesnt get a user mass whilst the blue one does!!
So everything is fine, this might come in handy for anyone,better than waste!
Hail to the king, baby!

Login to post a reply

Server time is: 2024-04-16 20:26:43
Your offset time is: 2024-04-16 20:26:43