当前位置:网站首页>Realize ray detection, drag the mouse to move the object and use the pulley to scale the object
Realize ray detection, drag the mouse to move the object and use the pulley to scale the object
2022-07-07 10:48:00 【HCC2017】
public class Script : MonoBehaviour {
public GameObject obj;
public float s;
void Update () {
Ray ray = new Ray();
RaycastHit hit;
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Input.GetMouseButton(0))
{
if (Physics.Raycast(ray,out hit,100))
{
obj.transform.position = new Vector3(hit.point.x,hit.point.y,0);
}
}
if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
s += Input.GetAxis("Mouse ScrollWheel");
obj.transform.localScale = new Vector3(s, s, s);
}
if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
s += Input.GetAxis("Mouse ScrollWheel");
obj.transform.localScale = new Vector3(s, s, s);
}
}
}
边栏推荐
- 【亲测可行】error while loading shared libraries的解决方案
- MONAI版本更新到 0.9 啦,看看有什么新功能
- Network engineer test questions and answers in May of the first half of 2022
- 高级软考(网络规划设计师)该如何备考?
- 南航 PA3.1
- Prototype and prototype chain
- Summary of router development knowledge
- Those confusing concepts (3): function and class
- Some online academic report websites and machine learning videos
- 【PyTorch 07】 动手学深度学习——chapter_preliminaries/ndarray 习题动手版
猜你喜欢
1323: [example 6.5] activity selection
Five simple and practical daily development functions of chrome are explained in detail. Unlock quickly to improve your efficiency!
The difference between monotonicity constraint and anti monotonicity constraint
String formatting
When do you usually get grades in the soft exam? Online pedaling?
Mendeley--免费的文献管理工具,给论文自动插入参考文献
【安装系统】U盘安装系统教程,使用UltraISO制作U盘启动盘
Find the root of equation ax^2+bx+c=0 (C language)
Prototype and prototype chain
Trajectory planning for multi robot systems: methods and Applications Overview reading notes
随机推荐
软考中级电子商务师含金量高嘛?
How to successfully pass the senior system architecture designer in the second half of the year?
IO model review
SQL Server knowledge gathering 9: modifying data
Five simple and practical daily development functions of chrome are explained in detail. Unlock quickly to improve your efficiency!
【推荐系统 01】Rechub
What is an intermediate network engineer? What is the main test and what is the use?
1323: [example 6.5] activity selection
2022年7月10日“五心公益”活动通知+报名入口(二维码)
What are the test preparation materials and methods for soft exam information processing technicians?
深入理解Apache Hudi异步索引机制
单调性约束与反单调性约束的区别 monotonicity and anti-monotonicity constraint
OpenGL glLightfv 函数的应用以及光源的相关知识
China Southern Airlines pa3.1
Some online academic report websites and machine learning videos
南航 PA3.1
Elegant controller layer code
ThreadLocal is not enough
如何顺利通过下半年的高级系统架构设计师?
IDA中常见快捷键