mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 16:52:43 +08:00
4bc2739786
* Vmath (#4895) * vmath refactor * value-type API change * vmath change update * conflict fix * value types change * translate modify (#4917) * value types bug fixed (#4940) * playground update (#4946) * bug fixed * bug fixed * bug fixed * bug fix * util modify * create remove & ccenum rename * export by cc.math * Rename value-types to math * util funtion deprecated warn * value-types change * color test fix * color API change
39 lines
966 B
TypeScript
39 lines
966 B
TypeScript
/**
|
|
* @hidden
|
|
*/
|
|
|
|
import { Component } from '../../components/component';
|
|
import { Vec3 } from '../../core/math';
|
|
import { RigidBodyBase, ShapeBase } from './api';
|
|
import { INode } from '../../core/utils/interfaces';
|
|
|
|
export class RaycastResult {
|
|
get hitPoint (): Vec3 {
|
|
return this._hitPoint;
|
|
}
|
|
|
|
get distance (): number {
|
|
return this._distance;
|
|
}
|
|
|
|
get collider (): Component {
|
|
return this._collidier!;
|
|
}
|
|
|
|
get node (): INode {
|
|
return this._node!;
|
|
}
|
|
|
|
private _hitPoint: Vec3 = new Vec3();
|
|
private _distance: number = 0;
|
|
private _collidier: Component | null = null;
|
|
private _node: INode | null = null;
|
|
|
|
public _assign (hitPoint: any, distance: number, shape: ShapeBase, body: RigidBodyBase) {
|
|
Vec3.copy(this._hitPoint, hitPoint);
|
|
this._distance = distance;
|
|
this._node = body.getUserData();
|
|
this._collidier = shape.getUserData() as Component;
|
|
}
|
|
}
|