Forum

> > Trash > [SOLVED] Click collision with terrain checking.
Forums overviewTrash overviewLog in to reply

English [SOLVED] Click collision with terrain checking.

No replies
To the start Previous 1 Next To the start

closed moved [SOLVED] Click collision with terrain checking.

Rainoth
Moderator Off Offline

Quote
For the tool I am currently scripting, I need to check if I click on terrain.
I need to know that the player definitely clicked on terrain to procceed. So I basically handle this with weapon_mode setting and weapon_position but the issue is that when I use the following line:
1
2
3
4
5
6
if weapon_position == 1 then
		if collision(col1x1,weapon_x,weapon_x,1,0)==0 then
			print("Invalid position")
			weapon_position = 0
		end
	end
but it returns both 1 and 0 despite me clicking random spots on terrain. It's weird cause I'm clicking all around on earth (the generated terrain is untouched) and yet I sometimes get collision and sometimes I don't. I tried to use 2x2, colplayer collision images but those returned false all the time.
To be honest. I'm not exactly sure how collision works here so I might be missing out on something.

Help. Thanks.

// I fucked up big time. Silly mistake. Shame on me. Damn. I'm going to hide in the basement now.
To the start Previous 1 Next To the start
Log in to replyTrash overviewForums overview