Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, RealSerious3D, BrainSailor), 1,265 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Object without gravity #166101
11/06/07 09:26
11/06/07 09:26
Joined: Mar 2005
Posts: 12
R
Richey Offline OP
Newbie
Richey  Offline OP
Newbie
R

Joined: Mar 2005
Posts: 12
Is it possible to gave a physics object that is not affected by gravity?

I'd like to implement a object that is controlled by mouse movement and the movement of that object to affect other physics objects. Like a bat controlled by the player hitting a ball.

I hoped to do this with phent_addcentralforce and setting the mass to 0 but with the mass set phent_addcentral force does not seem to apply. If I don't set mass then the object falls to the gound.

Re: Object without gravity [Re: Richey] #166102
11/10/07 07:41
11/10/07 07:41
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
I actually find that an entity with just a c_setminmax works fine. The entity shoves into the physics object a little, but it does interact properly.

I came up with this "3D Cursor" concept for a project that I'm working on:

Code:


ENTITY* cur_ent;
BMAP* cur= "rcursor.pcx";

void curent()
{
cur_ent= me;
c_setminmax(me);
my.scale_x= 0.25;
my.scale_y= 0.25;
my.scale_z= 0.25;
while(1)
{
my.pan= camera.pan - 90;
my.tilt= camera.roll;
my.roll= camera.tilt;
mouse_dist+= mickey.z * 0.1;
vec_set(curpos,vector(mouse_cursor.x,mouse_cursor.y,mouse_dist + 50));
vec_for_screen(curpos,camera);
cur_ent.x= curpos.x;
cur_ent.y= curpos.y;
cur_ent.z= curpos.z;
wait(1);
}
}

and a function for switching between 2D and 3D mouse cursors:

void _3dcur_toggle()
{
if(cur_mode== 1)
{
if(mouse_ent== cur_ent)
{
ent_remove(cur_ent);
snd_play(toggle_,100,0);
spawn_mode= 0;
}
else
{
cur_mode= 0;
}
mouse_map= cur;
mouse_dist= 0;
wait(3);
}
if(cur_mode== 0)
{
snd_play(toggle_,100,0);
ent_create("cur.mdl",nullvector,curent);
cur_mode= 1;
spawn_mode= 1;
mouse_map= NULL;
}
}



You may want to change the images, the model, and the camera synchronization calculations (my "cur.mdl" is oriented incorrectly in MED). Other than that, good luck!

Hope this helps


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1