Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411530 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 02:14:22 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Quick collision question
Pages: [1]
Print
Author Topic: Quick collision question  (Read 1318 times)
MaloEspada
Guest
« on: January 22, 2010, 01:50:21 PM »

Well, I'm having a problem with two objects colliding (both solids):


The dark green is supposed to be ground, while the lime-green is a block object that falls.
As you can see, the lime-green goes "into" the dark green ground.

The code I use for collision for the lime-green with the dark-green is:

Code:
move_contact_all(270,-1)
vspeed=0

I've tried changing it to move_contact_solid(270,0) and other variations, but it always ends up going into it sometime.


Can someone out there help me?
Logged
Desert Dog
Level 4
****



View Profile
« Reply #1 on: January 22, 2010, 03:53:29 PM »

I usually have:
Code:
move_contact_solid(direction,vspeed)
vspeed=0;

In my collision events, with a solid object. I'm unsure how two solid objects would react, though, it's really, not advisable to have a moving solid object, here's a quote from the GM help manual:
Quote from: GM help
Collisions with solid objects are treated differently from collisions with non-solid objects. You are strongly advised to use Solid only for object that are not moving.  

So, my advice is either know what your doing&be very careful, making sure the results are always consistent, or make the lime-green block non-solid. I would opt for the latter.

Good luck,
~DD

Logged

MaloEspada
Guest
« Reply #2 on: January 22, 2010, 05:10:43 PM »

That certainly helped Desert Dog!
I made so that the lime block is non solid and after it gets on ground, it becomes solid :D
Logged
Desert Dog
Level 4
****



View Profile
« Reply #3 on: January 22, 2010, 06:42:49 PM »

Glad to have helped!  Coffee

Just if your interested, gmXpert2000 of the GMC forums wrote an interesting article/tut on why to never use solid in GM, here. It's an interested read, while I don't fully agree with it. [I think it's case-by-case... in some cases, using solid is just a pain in the neck, and shouldn't be done, while in other cases, it's a very efficient way to save work, since it's all built in already.]

Logged

ChevyRay
Guest
« Reply #4 on: January 22, 2010, 07:31:40 PM »

Yeah, when I used GM I never used most of the built-in GM properties such as solid, hspeed/vspeed, gravity, and all that stuff. I always preferred to use my own variables and iterate the values myself, that way I could always be in control of what was happening, and wouldn't have to worry about weird GM side effects.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic