当前位置:网站首页>Unity关于本地坐标和世界坐标之间的转换
Unity关于本地坐标和世界坐标之间的转换
2022-06-24 19:19:00 【charlsdm】
常用的就是transformPoint这一类的API引用了
下面附上我写的代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CreateCube : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
[ContextMenu("左前方创建空物体")]
void TestFun1()
{
// Vector3 pos = this.transform.TransformPoint(new Vector3(-1, 0, 1));
GameObject obj = new GameObject("hello");
obj.transform.position = this.transform.TransformPoint(new Vector3(-1, 0, 1));
}
[ContextMenu("勉强创建3个球体")]
void TestFun2()
{
GameObject objOne = GameObject.CreatePrimitive(PrimitiveType.Sphere);
objOne.transform.position = this.transform.TransformPoint(new Vector3(0, 0, 1));
GameObject objTwo = GameObject.CreatePrimitive(PrimitiveType.Sphere);
objTwo.transform.position = this.transform.TransformPoint(new Vector3(0, 0, 2));
GameObject objThree = GameObject.CreatePrimitive(PrimitiveType.Sphere);
objThree.transform.position = this.transform.TransformPoint(new Vector3(0, 0, 3));
}
}
边栏推荐
- Different WordPress pages display different gadgets
- Failed to open after installing Charles without any prompt
- List set Introduction & common methods
- Variable setting in postman
- Alibaba cloud lightweight servers open designated ports
- [cloud native learning notes] deploy applications through yaml files
- Simpledateformat thread unsafe
- yeb_ Back first day
- What does CTO (technical director) usually do?
- PIXIV Gizmo
猜你喜欢

Nifi quick installation (stand-alone / cluster)

Background operation retry gave up; KeeperErrorCode = ConnectionLoss

memcached全面剖析–2. 理解memcached的内存存储

Sleep revolution - find the right length of rest

Php-pdo parameter binding problem

What does CTO (technical director) usually do?

Pytest testing framework

JMeter implementation specifies concurrent loop testing

去掉录屏提醒(七牛云demo)

Microsoft Certification (dynamic 365) test
随机推荐
PIXIV Gizmo
Dijkstra seeking secondary short circuit (easy to understand)
After screwing the screws in the factory for two years, I earned more than 10000 yuan a month by "testing" and counterattacked
Learn together and make progress together. Welcome to exchange
Nifi quick installation (stand-alone / cluster)
Distributed basic concepts
Handling of garbled JMeter response data - three solutions
Static routing experiment
More than ten years' work experience is recommended at the bottom of the box: how much does it cost to find a job? See here! Brothers and sisters are recommended to collect and pay attention
Time standard and format
how to install clustershell
CondaValueError: The target prefix is the base prefix. Aborting.
Minimum cost and maximum flow (template question)
2021-09-30
Steps of JMeter performance test
Shrimp skin test surface treated
[cloud native learning notes] kubernetes Foundation
Network layer
Alibaba cloud schedules tasks and automatically releases them
Go coding specification