Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got crash when i pass reference arguments #504

Open
justqstn opened this issue Apr 11, 2024 · 0 comments
Open

got crash when i pass reference arguments #504

justqstn opened this issue Apr 11, 2024 · 0 comments

Comments

@justqstn
Copy link

justqstn commented Apr 11, 2024

pc windows 10
game - pixel gun 3d

i pasted this code into update function
code

 while (b.method("MoveNext").invoke()) {
                let pos: Il2Cpp.Object = b.method("get_Current").invoke().method("get_MechHeadTransform").invoke().method("get_position").invoke(); //
                let ray = this.field("gunCamera").value.method("ScreenPointToRay", 1).overload("UnityEngine.Vector3").invoke(asc.class("SupportAimController").method("get_CenterOfScreen").invoke());
                let screenpoint = this.field("gunCamera").value.method("WorldToScreenPoint", 1).overload("UnityEngine.Vector3").invoke(pos);
                //jlog(asc.class("SupportAimController").method("get_CenterOfScreen").invoke().type)
                
                
                // here is raycast
                let _st = Il2Cpp.domain.assembly("UnityEngine.PhysicsModule").image.class("UnityEngine.RaycastHit");
                let res = new Il2Cpp.Reference(Memory.alloc(Process.pointerSize).writePointer(_st.handle), _st.type);
                let rayres = Il2Cpp.domain.assembly("UnityEngine.PhysicsModule").image.class("UnityEngine.Physics").method("Raycast", 2).overload("UnityEngine.Ray", "out UnityEngine.RaycastHit").invoke(ray, res.handle)
                //jlog(res.value.method("get_collider").invoke())
                //jlog(screenpoint)
                

                
                let dist = _Vector3.method("Distance").invoke(pos, ray.method("GetPoint", 1).invoke(_Vector3.method("Distance").invoke(pos, my_pos)))
                jlog(dist, b.method("get_Current").invoke().field("nickLabel").value.method("get_text").invoke())
                //this.field("myCameraContainer").value.method("LookAt").invoke(b.method("get_Current").invoke().method("get_MechHeadTransform").invoke())
            }

@justqstn justqstn changed the title got crash when call method Physics.Raycast got crash when i pass reference arguments Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant