Posted: 19th Apr 2023 0:50
Ok so I do not know how to cast a ray properly, everytime I do my program freezes. I need to do a check in front of my 3d player and also for walking in water and the water has no collison. I am lost.

But I also need to figure out how to detect if im walking on water also. I repeat this because the function here is just for picking up objects.

What freezes my program.

+ Code Snippet
function PickUpItems()

 For x=InventoryPickUps.length to 0 Step -1
	 
global oldx#
global oldy#
global oldz#
global newx#
global newy#
global newz#

        oldx# = GetObjectX(player)-11
        oldy# = GetObjectY(player)
        oldz# = GetObjectZ(player)
 
        newx# = GetObjectX(x)+11
        newy# = GetObjectY(x)
        newz# = GetObjectZ(x)
        
if GetObjectExists(x)=1
hitID = ObjectRayCast(0,oldx#,oldy#,oldz# ,newx#,newy#,newz#)
if hitID=x then print("Hit")
endif
next x

endfunction
Posted: 19th Apr 2023 3:59
Ok so I figured this out for collecting items and the water by using vector3 but when I delete a item from the system it crashes and not sure why.
So I have to just hide them.

+ Code Snippet
function PickUpItems()

For x=InventoryPickUps.length to 0 Step -1

if GetObjectExists(InventoryPickUps[ x].Items)=1
hitID = GetObjects3DPhysicsContactPositionVector(InventoryPickUps[ x].Items,Player,This2V3)

if hitID=1
 SetObjectVisible(InventoryPickUps[ x].Items,0)
endif
endif
next x

endfunction
Posted: 21st Apr 2023 18:14
Hi,

I replied in your other thread:
https://forum.thegamecreators.com/thread/229063

PSY
Posted: 21st Apr 2023 18:37
Thank you and it works, I thought APPGAMEKIT was broken lol, I guess not.
Posted: 21st Apr 2023 20:06
No problemo