Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AemStones, AndrewAMD, gamers, Kingware), 1,679 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Entity placed lower with gravity... #17403
09/21/03 00:42
09/21/03 00:42
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
Started doodling with physics, I have a map entity, the motion is fine, but it is placed lower in the level than it is set in WED. I want it hanging from the ceiling, not 10 feet below it. Changing the earthgravity seems to affect the location...the smaller the Z the lower it gets...if I make it 0 it is ALMOST where it should be. So how do I keep it where it should be without compromising my motion?

Code:
var earthgravity[3] = 0,0,-386;
var hingeID;
var anchor[3];
var axis[3] = 1,0,0;
var allowed_angles[3] = -90,90,0;

action light_sway //level 1 hanging light
{
while(player == null) {wait(1);}
phent_settype( me, PH_RIGID, 0 );
phent_setmass ( me, 2.5, 0 );
phent_setdamping ( me, 30, 30 );
ph_setgravity( earthgravity );
waitt( 16 );
vec_set( anchor, me.x );
//anchor.z = me.z;
hingeID = phcon_add( PH_HINGE, me, 0 );
phcon_setparams1( hingeID, anchor, axis, nullvector );
phcon_setparams2( hingeID, allowed_angles, nullvector, nullvector);
}




My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Entity placed lower with gravity... [Re: Orange Brat] #17404
09/21/03 00:55
09/21/03 00:55
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
you shouldn't wait before applying the hinge!

Re: Entity placed lower with gravity... [Re: ventilator] #17405
09/21/03 01:12
09/21/03 01:12
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
Not using a waitt or moving it results in no movement and it's still lower than where I set it only not as low.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Entity placed lower with gravity... [Re: Orange Brat] #17406
09/21/03 01:27
09/21/03 01:27
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
the hull type shouldn't be 0!

Re: Entity placed lower with gravity... [Re: ventilator] #17407
09/21/03 01:35
09/21/03 01:35
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
The entity will never collide with anything, changing this has no affect. It should swing back and forth and does so nicely but only with a waitt..which leads to it getting lowered. Getting rid of the waitt does return it to where it should be(I was wrong in my last post), but there's no motion.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Entity placed lower with gravity... [Re: Orange Brat] #17408
09/21/03 01:53
09/21/03 01:53
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
i think without hull physics entities don't work properly.

gravity is a global setting. try to set it before this action starts!

Re: Entity placed lower with gravity... [Re: ventilator] #17409
09/21/03 02:31
09/21/03 02:31
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
I stuck the gravity and phcons in the main and the pivot was in the center of the entity instead of the origin. It stays in place, but the entity is rotated for whatever reason when it stops moving.

This is starting to drive me bonkers. The only way to get it right is to use a waitt(16) but that allows it to sink..take it away and nothing....do what I just described and it is screwier.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Entity placed lower with gravity... [Re: Orange Brat] #17410
09/21/03 03:26
09/21/03 03:26
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
...it's strange that it doesn't work then! have you tried using a normal entity instead of a map entity?

Re: Entity placed lower with gravity... [Re: ventilator] #17411
09/21/03 04:47
09/21/03 04:47
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
Yeah, no different..aww forget it, not worth the headaches..thanks for the pointers.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Entity placed lower with gravity... [Re: ventilator] #17412
09/21/03 09:58
09/21/03 09:58
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
I like my headaches migraine style, so I'm taking one last jab at this so I'm going to restate my initial post with a better description of what I'm shooting for. Here's what I'm trying to accomplish(this is open to anyone..I'm sure ventilator wants to punch me )...

I have a light hanging from the ceiling(map entity, not a model), it needs to be affected by a force that makes it swing back and forth like a pendulum, so it needs to be a HINGE style constraint. It should be connected to the level and not a 2nd entity, so I make the appropriate phcon_add parameter a "0" as called for in the manual. This light will probably never come in contact with any other entity, so I'm not concerned about it doing so(though I had always thought about making it shootable but I'll save that for another time).

The trick is is that I don't want it to be mechanical(if I wanted that, I wouldn't need physics)...I want it to be a random movement or at least appear that way, and the way the physics engine makes it move is perfect...it's organic and realistic.

The problem, as is apparent, is that this pendulum light will not move. I THINK it is set up correctly, but I cannot get it to move in place. I've tried applying some of the addforce instructions, but have had zero success.

Here's the code again, from above, with slight modifications:

Code:
var earthgravity[3] = 0,0,-386;

var hingeID;
var anchor[3];
var axis[3] = 1,0,0;
var allowed_angles[3] = -45,45,0;

action light_sway //level 1 hanging light
{
while(player == null) {wait(1);}
phent_settype( me, PH_RIGID, PH_SPHERE );
phent_setmass ( me, 2.5, PH_SPHERE );
phent_setdamping ( me, 30, 30 );
vec_set( anchor, me.x ); //
anchor.z = me.z;
hingeID = phcon_add( PH_HINGE, me, 0 );
phcon_setparams1( hingeID, anchor, axis, nullvector );
phcon_setparams2( hingeID, allowed_angles, nullvector, nullvector);
}



I understand that gravity must be called outside of the action...I've done this as well as getting rid of the waitt instruction...I'm guessing the the pause allowed the physics entity to fall and then when it stopped it was simply moving the object as it should(the constraint seemed to be the pivot point, so that is what leads me to believe that I have it setup correctly). That removal basically solves my original problem and tricked me into thinking I was getting the motion I wanted since it was merely reacting to being dropped.

The back and forth motion is not dependent on player interaction...it just sways harmlessly in a faked wind. So, a) I'm hoping for someone to confirm that my code is correct or am I just approaching this the wrong way?, and b) Assuming I'm on the right track, how do I move the light as I described?

Any additional pointers or suggestions would be welcomed..I've run out of tricks and aspirin.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Page 1 of 2 1 2

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