My first "Test"

this is a test of the ray sensor,

I am needing to use a ray in my “Property applicator” but I don’t see the hitPoly referance that the python object.raycast Function has…
like

hitOb, hitPos, hitNormal, hitPoly = object.rayCast(end, start, 0, ‘’, 0, 0, 1)

help?

here is my ray sensor test,

I need to return the material of the object struck…

this just prints all the data I know how to access from the sensor,
I need the “hitMat”

Attachments

ExampleRay.blend (427 KB)

Tutorials for blender websight class KX_vertexProxy – blender game engine 2.49b.I know it is old but take a look at it.

Please look at the bge api specifically for rayCast of KX_GameObject.

I know it is very confusing, but under the clutter of different options different results there is the polyProxy as 3D solar system builder mentioned.

Have a look what to provide as input to get the desired results. Then check the api for polyproxy how to get the material.

Kevin and raco helped write the componet cube,

it’s great, but I need a simple

hitting space casts ray from cube,
ray hitting any object returns it’s material

Could you whip one up monster?

this could be helpfull for more then just me,

on a related note___

Can we add in support for polyProxy to the “Ray Sensor” ?? rather then just the gameobject.rayCast -
rayCast(to, from, distance, property, face, xray, poly) ???

At least “HitMat” as it is one of the “flags” that can be set with it? (detect materials)

using the python is ok, but hard to wrap my head around what is required, and what can be shifited in game,

I do not think there is much use for that. The most games use a single material per object anyway.

Its for the collision physics object, so you could identify head, gun, front, whatever, and for why I need it…