|
pXent_settype
#451374
05/05/15 02:18
05/05/15 02:18
|
Joined: Apr 2015
Posts: 9 Ontario, Canada
kornstar
OP
Newbie
|
OP
Newbie
Joined: Apr 2015
Posts: 9
Ontario, Canada
|
Hi, I'm trying to create a small game that uses physics to move a ball around on a small flat table by tilting the table, I have successfully added physics to the ball (as far as I know) from the example in the workshops but I'm having a hard time setting up the table. I first tried to simply set the table to tilt/roll using mouse_force.x and mouse_force.y and was able to get the table to move as I wanted it to but without adding the 'pXent_settype' I found that the ball would go right through the table. I then tried to add physics to the table using PH_BOX, but the table is then subject to gravity (just like the ball) and falls out of sight. My latest attempt was to set the table to
pXent_settype(me, PH_RIGID, PH_PLANE);
and the table stays where I put it but now the movement of the mouse no longer affects the tilt/roll of the table. does anyone know if/how I can set-up the physics on the table so that the ball will not go through the table but still be able to make the table tilt/roll with the movement of the mouse and not have it fall with gravity? any and all help with this is appreciated edit: I recently found the includes folder and opened ackphysX.h and am reading through it to try to figure this out, but still any help from experienced users is appreciated.
Last edited by kornstar; 05/05/15 03:15.
|
|
|
Re: pXent_settype
[Re: txesmi]
#451384
05/05/15 08:16
05/05/15 08:16
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hi! I think you are trying to create something similar to Labyrinth game on mobile devices (you won't be able to see the rolling of the table on the video, cause iphone is actually the table ). I've made one pretty long time ago, and I didn't roll the table at all! Think about it in a different way! Don't roll the table, but change camera angles instead! For the end user is doesn't really matter since it looks like table is rolling and ball is moving correctly. Edit: I finally found this old thread (it's from 2011) Edit2: as an example, try this demo (to understand what I've meant):
void main(){
fps_max = 60;
level_load("");
wait(3);
ENTITY* planeEnt = ent_create(CUBE_MDL, nullvector, NULL);
vec_set(planeEnt.scale_x, vector(10, 10, 0.5));
wait(1);
c_setminmax(planeEnt);
var i = 0;
ENTITY* testEnt[4];
for(i = 0; i < 4; i++){
testEnt[i] = ent_create(CUBE_MDL, nullvector, NULL);
vec_set(testEnt[i].scale_x, vector(10, 1, 1));
wait(1);
c_setminmax(testEnt[i]);
}
vec_set(testEnt[0].x, vector(0, planeEnt.max_y - testEnt[0].max_y, testEnt[0].max_z - (testEnt[0].min_z / 2)));
vec_set(testEnt[1].x, vector(0, planeEnt.min_y + testEnt[1].max_y, testEnt[1].max_z - (testEnt[1].min_z / 2)));
vec_set(testEnt[2].x, vector(planeEnt.max_x - testEnt[2].max_y, 0, testEnt[2].max_z - (testEnt[2].min_z / 2)));
vec_set(testEnt[3].x, vector(planeEnt.min_x + testEnt[3].max_y, 0, testEnt[3].max_z - (testEnt[3].min_z / 2)));
testEnt[2].pan += 90;
testEnt[3].pan += 90;
var cam_pan = 0, cam_tilt = -90;
camera.arc = 90;
while(1){
cam_pan -= 0.05 * mickey.x;
cam_pan = clamp(cam_pan, -5, 5);
cam_tilt -= 0.05 * mickey.y;
cam_tilt = clamp(cam_tilt, -95, -85);
vec_set(camera.pan, vector(0, cam_tilt, 0));
ang_rotate(camera.pan, vector(cam_pan, 0, 0));
vec_set(camera.x, vector(-(cam_tilt + 90) * 2, -(cam_pan) * 2, 150));
wait(1);
}
}
Greets
Last edited by 3run; 05/05/15 09:42. Reason: added code
|
|
|
Re: pXent_settype
[Re: alibaba]
#451386
05/05/15 08:40
05/05/15 08:40
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I think setting the table as PH_CHAR and rotating it with pXent_rotate should also work. Just try it! Unfortunately it won't, cause CHAR can have only BOX and CAPSULE shape (maybe convex works too, but it has it's limits too). Greets
|
|
|
Re: pXent_settype
[Re: 3run]
#451395
05/05/15 15:31
05/05/15 15:31
|
Joined: Apr 2015
Posts: 9 Ontario, Canada
kornstar
OP
Newbie
|
OP
Newbie
Joined: Apr 2015
Posts: 9
Ontario, Canada
|
I think you are trying to create something similar to Labyrinth game on mobile devices (you won't be able to see the rolling of the table on the video, cause iphone is actually the table ). I've made one pretty long time ago, and I didn't roll the table at all! Think about it in a different way! Don't roll the table, but change camera angles instead! For the end user is doesn't really matter since it looks like table is rolling and ball is moving correctly. You are correct, the old school labyrinth "board" game is exactly what I was thinking about, It seemed to be a fairly simple idea to create, I'm now figuring out that there will be a lot more to it than I had originally anticipated (as is the case with almost any idea I have), but I'm going to stick with it for learning purposes. Just to clarify, I think that what you meant by: Think about it in a different way! Don't roll the table, but change camera angles instead! is to keep the table flat, apply the forces to the ball instead and have the camera tilt to create the illusion that the table is tilting. Is that what you meant? @ txesmi, 3run, and alibaba: thank you all for taking the time to help me, I very much appreciate it and I will look through and try your suggestions sometime today. Thanks again
|
|
|
Re: pXent_settype
[Re: DLively]
#451405
05/05/15 17:11
05/05/15 17:11
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Just to clarify, I think that what you meant by: Think about it in a different way! Don't roll the table, but change camera angles instead! is to keep the table flat, apply the forces to the ball instead and have the camera tilt to create the illusion that the table is tilting. Is that what you meant? Yes, that's exactly what I've meant. Don't rotate the table, but rotate and move camera (in the opposite direction of the rotation)! Create 'illusion' of rotating table. I'm pretty sure none of those games actually really rotating the table, it's more likely to be a static object, for performance and stable simulation issues. To make things even more clear, just run the code I'm posted above, it already has camera movement part, so you can start with it as a base. You can also use those two variables (which are used to rotate and move camera) to apply forces to the ball (in the opposite direction of the rotation I guess), so it will really looks like table is rotating, and ball is sliding down. is to keep the table flat, apply the forces to the ball instead and have the camera tilt to create the illusion that the table is tilting. Is that what you meant? Yes that is exactly what was suggested Thank you scorekeeper Best regards!
|
|
|
Re: pXent_settype
[Re: DLively]
#451409
05/05/15 17:56
05/05/15 17:56
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Thank you scorekeeper What do you mean? That means that I don't need anyone to confirm my words and speak for me. Keep that in mind in order to avoid misunderstandings in future Best regards
|
|
|
Re: pXent_settype
[Re: DLively]
#451413
05/05/15 18:08
05/05/15 18:08
|
Malice
Unregistered
|
Malice
Unregistered
|
Lol love these combative posts. But to help the newbies can we port them over to a Rants? It floods the thread otherwise.
Just asking, Mal
|
|
|
Re: pXent_settype
[Re: ]
#451416
05/05/15 18:16
05/05/15 18:16
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Thanks, But I can say what I want, when I want. Keep that in mind in order to avoid misunderstandings in the future. Man, say whatever you want, but don't speak for me, ok? As I've said, if I'll need scorekeeper, I'll let you know. Lol love these combative posts. But to help the newbies can we port them over to a Rants? It floods the thread otherwise.
Just asking, Mal You are actually right. My bad. kornstar@ sorry for offtopic man. Best regards
|
|
|
Re: pXent_settype
[Re: DLively]
#451418
05/05/15 18:23
05/05/15 18:23
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I didn't speak for you. I spoke for myself. Infact, I AGREED with what you said, so stop being so uptight. Your not the Admin, or mod. Just a user. Stop trying be something your not - the boss. I'll do and say what I want when I want and agree with or disagree with whomever I'd like. In other words: (I don't need your permission to post on this forum) stop offtopic and check your PM!
|
|
|
Re: pXent_settype
[Re: 3run]
#451419
05/05/15 18:27
05/05/15 18:27
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
Serious User
|
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
You totaly, needlessly went off topic, and continue to do so. If you want to boss people around, or be a bully -- Im sure others would advise you to go to your own forum.
I simply told kornstar that the information you provided was correct (staying on topic) Your attempts to be be-little me brought it off topic.
Last edited by DLively; 05/05/15 18:28.
|
|
|
Re: pXent_settype
[Re: kornstar]
#451421
05/05/15 18:42
05/05/15 18:42
|
Malice
Unregistered
|
Malice
Unregistered
|
and if I have any other questions I will post them in a new thread specific to the question My point.
|
|
|
Re: pXent_settype
[Re: kornstar]
#451422
05/05/15 19:12
05/05/15 19:12
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
As far as I'm concerned the information I needed is all on the first page and if I have any other questions I will post them in a new thread specific to the question so feel free to duke it out all you like Usually we all leave in peace and harmony, don't think that forum is fulfilled with evil persons like me Edit: I just noticed that kornstar is from Canada too. Maybe you guys even know each other (DLively and kornstar), that makes sense actually. I would probably act the same (trying to help) if I would see someone from Russia over the forum. So I probably overreacted on what DLively wrote, and I'm sorry for that.
|
|
|
Re: pXent_settype
[Re: 3run]
#451431
05/06/15 02:14
05/06/15 02:14
|
Joined: Apr 2015
Posts: 9 Ontario, Canada
kornstar
OP
Newbie
|
OP
Newbie
Joined: Apr 2015
Posts: 9
Ontario, Canada
|
I just noticed that kornstar is from Canada too. Maybe you guys even know each other (DLively and kornstar), that makes sense actually. I would probably act the same (trying to help) if I would see someone from Russia over the forum. So I probably overreacted on what DLively wrote, and I'm sorry for that. At first I wasn't even sure if I wanted to answer that because I don't want any blow over because of it but yes DLively and I do know each other, in fact we are related, I am his older cousin. It was DLively who got me interested in 3dgs in the first place, and much of what I know already was learned from him. He used to help me with advice over the phone but our schedules don't always match up so I decided to start looking for help on the forum, I also figured that on the forum I would have access to the wide well of knowledge offered by the many helpful forum users and in the end the more input I can get...the more I will learn... and ultimately the better off I would be. OH and don't worry about the "battle" posts, I have used many forums in the past and one thing that I learned is that when this many people get together in one place, people tend to butt heads from time to time (I'm not calling you Buttheads...well maybe DLively...lol ) so I have not formed any bad impressions about this forum because of a couple little squabbles. I know from DLively that this is a great community and I look forward to getting to know you all regardless of what disagreements you have among each other. So to end this all off I will say Thank you one more time to you all for the help with my question, and I'm sure I will have more questions for you all in the near future.
|
|
|
|