Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
problem with collision; this is urgent
Topic Started: Nov 12 2007, 05:38 PM (387 Views)
13bgarli
Member
[ *  * ]
ok i'm working on a game, and I am haveing problems with collision, see for your self

Posted Image

see it's not going all the way to the model it stop's before it get's there, and the arrow is also a model, if that help's. this is the code i am useing.

Code:
 

dist=GetDistanceToModel(mech,x,y,z,rotx,roty);
      if (dist < 100000) then {
      DirVect=CreateDirectionVector(-1,rotx,roty);
      CalculateVectorScalarProduct(DirVect,DirVect,dist);
      X=x+GetVector(DirVect,1);
      Y=y+GetVector(DirVect,2);
      Z=z+GetVector(DirVect,3);
      ReleaseVector(DirVect);
ii=instance_create(x,y,smoke);
iii=instance_create(x,y,shoot_stay);
ii.z=z;
iii.z=z;
instance_destroy();
}


there is also a var called down that makes the arrow move down, but i tried it with out down var and it still dosen't work.

i cannot work anymore untill i get this fixed please help,
thankyou ,
13bgarli
Posted Image
Offline Profile Quote Post Goto Top
 
13bgarli
Member
[ *  * ]
hello, i really need this :( :( :( :( :(

i can't continue untill i have a working collision system, because it will make the rest really really hard...

please help,
13bgarli
Posted Image
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
Well, first of all, you should set mech to mech.id

Also you should set zz to z+height

Also you do realize the bullethole's z will always be a constant value...You did not implement 3d locational placing...
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Eanbro
Nov 15 2007, 02:49 PM
Well, first of all, you should set mech to mech.id

Also you should set zz to z+height

Also you do realize the bullethole's z will always be a constant value...You did not implement 3d locational placing...

What in the world are you talking about?

What it seems he's doing wrong is multiplying his vector by the distance to the building. Any other 'errors' are just a different coding style. For example, I like having functions defined as lower case with underscores with the first level capitalized, while the Doctor forces the non-underscore style, which I actually am starting to like better.
Quote:
 
  Well, first of all, you should set mech to mech.id

Read GM's manual, and you'll see that it returns the id of the object with the same object id, but the smallest y coordinate. Why is it the smallest y coord? I don't know, go ask Mr. Overmars! And if you ask me, that has to be a fake name.
Blog|EHS
Offline Profile Quote Post Goto Top
 
zelda4evr
Member Avatar
Forum God
[ *  *  *  *  *  * ]
well what i did was i changed

Code:
 
if (dist < 100000) then {

to
Code:
 
if (dist < 10) then {


and it worked pretty good. i might also try what you(sharik) said.

yes im helping him with this.

Posted Image
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
No, thats definitely his real name. If you want you can visit the Netherlands and attend one of his lectures. And I was referring to the z of the bullet impact, he set it to a constant value, so it would be like a 2d fps (like DOOM.)

An btw, when no collision is returned, dist returns 99,000 (because of GM's imprecision.)
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
zelda4evr
Member Avatar
Forum God
[ *  *  *  *  *  * ]
what do you mean 2d fps? his collision script was working fine, its just the distance was wrong.

Posted Image
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
Like where there is no z aiming. His code uses the lowercase z instead of the Z variable. Read his code and you'll see what I'm talking about. Based on his code, it should create impacts at the player's x, y and z.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
13bgarli
Member
[ *  * ]
no, i figered it out thakes to Zelda4evr, it was the distance...

thankyou so much
Posted Image
Offline Profile Quote Post Goto Top
 
zelda4evr
Member Avatar
Forum God
[ *  *  *  *  *  * ]
your wrong Eanbro, this code is in the arrows step event, after it's created. everything is fine.

Posted Image
Offline Profile Quote Post Goto Top
 
Eansis
Member Avatar
ghost
[ *  *  *  *  *  * ]
Well, he figured it out, so its all good.
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY

Til'c
 
Things will not calm down Daniel Jackson. They will infact calm up.
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply